34 lines
713 B
C#
34 lines
713 B
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
namespace Art.temp.Editor.AnimationTools
|
|||
|
|
{
|
|||
|
|
public static class LinqExtensions
|
|||
|
|
{
|
|||
|
|
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(
|
|||
|
|
this IEnumerable<TSource> source,
|
|||
|
|
Func<TSource, TKey> keySelector)
|
|||
|
|
{
|
|||
|
|
var seenKeys = new HashSet<TKey>();
|
|||
|
|
foreach (var element in source)
|
|||
|
|
{
|
|||
|
|
if (seenKeys.Add(keySelector(element)))
|
|||
|
|
{
|
|||
|
|
yield return element;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static class TransformExtensions
|
|||
|
|
{
|
|||
|
|
public static void ResetLocals(this Transform transform)
|
|||
|
|
{
|
|||
|
|
transform.localPosition = Vector3.zero;
|
|||
|
|
transform.localEulerAngles = Vector3.zero;
|
|||
|
|
transform.localScale = Vector3.one;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|