private void Awake() { if (stateEndEvent == null) { stateEndEvent = new AnimationEndEvent(); } }
/// <summary> /// Updates the animation. Not the part of entity loop, /// you need to call it on your own. /// /// NOTE: If using in Draw method, keep in mind that each camera calls the event separately. /// You may want to restrict it only to the first camera. /// </summary> public void Update() { if (!Running) { return; } LinearProgress += TimeKeeper.Time(Math.Abs(Speed)); if (LinearProgress > 1) { if (!Looping) { Running = false; LinearProgress = 1; } else { LinearProgress -= (int)LinearProgress; } AnimationEndEvent?.Invoke(this); } }
public void StartMoveEndEvent() { AnimationEndEvent?.Invoke(); }