public void Play(string animation) { Playing = true; PlayeringAnimation = animation; if (AnimationTracker.ContainsKey(animation)) { AnimationTracker[animation].FrameNumber = 0; } }
public void CrossFade(int Index, float FadeLength, bool RandomStart = false, System.Action OnDone = null) { if (Data != null) { if ((CurrentClipIndex < 0 || _Trackers[CurrentClipIndex]._Clip != Data.Clips[Index]) && Index < Data.Clips.Length) // if isnt already running { int CurrentClip = CurrentClipIndex; for (int i = 0; i < _Trackers.Length; i++) { if (_Trackers [i] != null) { _Trackers [i].SetFade(FadeLength, 0, OnDone); } } // set to fade out // set new tracker for (int i = 0; i < _Trackers.Length; i++) { if (i != CurrentClip) { AnimationTracker NewTracker = FindTrackerByClip(Data.Clips [Index]); if (NewTracker == null) { NewTracker = new AnimationTracker(Data.Clips [Index], Data); } _Trackers [i] = NewTracker; _Trackers [i].ResetFrames(); _Trackers [i].SetFade(FadeLength, 1, OnDone); if (RandomStart) { _Trackers [i].ResetRandomRange(); } break; } } } } }