private T Add <T>(AtomAnimationTargetsList <T> list, IComparer <T> comparer, T target) where T : IAtomAnimationTarget { if (target == null) { throw new NullReferenceException(nameof(target)); } list.Add(target); list.Sort(comparer); target.onSelectedChanged.AddListener(OnTargetSelectionChanged); target.onAnimationKeyframesDirty.AddListener(OnAnimationKeyframesDirty); onTargetsListChanged.Invoke(); return(target); }
private T Add <T>(AtomAnimationTargetsList <T> list, IComparer <T> comparer, T target) where T : IAtomAnimationTarget { if (target == null) { throw new NullReferenceException(nameof(target)); } if (target.clip != null) { throw new InvalidOperationException($"Target {target.name} already assigned to clip {target.clip.animationNameQualified}"); } target.clip = this; list.Add(target); list.Sort(comparer); target.onAnimationKeyframesDirty.AddListener(OnAnimationKeyframesDirty); onTargetsListChanged.Invoke(); return(target); }