示例#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);
    }
示例#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);
     }
 }