Exemplo n.º 1
0
    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();
    }
Exemplo n.º 2
0
    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);
        }
    }