protected void CompleteAnimation() { _rootObj.transform.localPosition = EndKey.Position; _rootObj.transform.localEulerAngles = EndKey.Rotation; if (PerFrameCallBack != null) { PerFrameCallBack.Invoke(_rootObj, 1.0f); } if (CompleteCallBack != null) { CompleteCallBack.Invoke(KiteAnimationCallBackType.Complete, _rootObj, 1.0f); } OnAnimationComplete(); }
public override void Update() { var percent = _currentTime / Duration; if (Mathf.Equals(percent, 1.0f)) { CompleteAnimation(); } else { LerpAnimation(percent); if (PerFrameCallBack != null) { PerFrameCallBack.Invoke(_rootObj, percent); } _currentTime += Time.deltaTime; _currentTime = Mathf.Min(_currentTime, Duration); } }