Exemplo n.º 1
0
    public void OnCrossFade(MoveEditor.Move move, float normalizedTime)
    {
        if (isCrossFading)
        {
            return;
        }

        isCrossFading = true;

        if (normalizedTime > 1.0f)
        {
            normalizedTime = normalizedTime - Mathf.Floor(normalizedTime);
        }
        float startingFrame = move == null ? 0.0f : normalizedTime * move._animationClip.length * move._animationClip.frameRate;

        if (currentMove != move)
        {
            regularEvents.Reset(move != null ? move.CompileMoveEvents(false) : null, startingFrame);
            requiredEvents.Reset(move != null ? move.CompileMoveEvents(true) : null, 0.0f);
            currentMove = move;
            moveChanged = true;
        }
        else if (currentMove != null && moveController != null)
        {
            AnimatorStateInfo stateInfo = moveController.GetCurrentStateInfo();
            if (stateInfo.fullPathHash == moveController.GetCurrentAnimHash())
            {
                float currentFrame = moveController.NormalizedTimeToFrame_Wrapped(stateInfo.normalizedTime);
                UpdateRegularEvents(regularEvents.lastUpdatedFrame, currentFrame);
            }
        }
        UpdateRequiredEvents(requiredEvents.lastUpdatedFrame, startingFrame);
    }
Exemplo n.º 2
0
 public void SetMove(MoveEditor.Move move, float startingFrame)
 {
     currentMove = move;
     regularEvents.Reset(move != null ? move.CompileMoveEvents(false) : null, startingFrame);
     requiredEvents.Reset(move != null ? move.CompileMoveEvents(true) : null, 0.0f);
     ResetPlayedNum(move != null ? move.CompileMoveEvents(false) : null);
     ResetPlayedNum(move != null ? move.CompileMoveEvents(true) : null);
     moveChanged = true;
     if (m_FXHelper != null && (move._moveState == MoveController.CombatantMoveState.kIdle) || move._moveState == MoveController.CombatantMoveState.kLocomotion)//by hzh: to prevent yabiao pathfinding bug
     {
         m_FXHelper.StopAll(true);
     }
 }
Exemplo n.º 3
0
    public void Update()
    {
        if (!GameEngine.Instance.IsTimeToRootScene)
        {
            return;
        }

        if (moveChanged)
        {
            moveChanged = false;
        }

        if (moveController == null)
        {
            return;
        }

        currentMove = moveController.CurrentMove;

        if (currentMove != null)
        {
            AnimatorStateInfo stateInfo = moveController.GetCurrentStateInfo();

            if (stateInfo.fullPathHash == moveController.GetCurrentAnimHash())
            {
                if (isCrossFading)
                {
                    isCrossFading = false;
                }

                float currentFrame = regularEvents.lastUpdatedFrame;                 //isCrossFading ? regularEvents.lastUpdatedFrame : moveController.NormalizedTimeToFrame_Wrapped(stateInfo.normalizedTime);
                float nextFrame    = moveController.NormalizedTimeToFrame_Wrapped(stateInfo.normalizedTime + (Time.deltaTime * myAnimator.speed / currentMove._animationClip.length));
                UpdateRequiredEvents(currentFrame, nextFrame);
                UpdateRegularEvents(currentFrame, nextFrame);
            }
        }
    }