NLDClient-yudde/ProjectNLD/Assets/Art/temp/Editor/AnimationTools/LinqExtensions.cs

34 lines
713 B
C#
Raw Normal View History

2024-12-23 10:19:53 +08:00
using System;
using System.Collections.Generic;
using UnityEngine;
2026-01-16 19:41:39 +08:00
namespace Art.temp.Editor.AnimationTools
2024-12-23 10:19:53 +08:00
{
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;
}
}
}