Exemplo n.º 1
0
    private void UpdateLogicAnimation(float deltaTime)
    {
        ActionMachineEvent eventTypes = actionMachine.eventTypes;

        if ((eventTypes & ActionMachineEvent.FrameChanged) != 0)
        {
            animatorTimer += deltaTime;
        }

        if ((eventTypes & ActionMachineEvent.StateChanged) != 0)
        {
            Debug.Log($"StateChanged:{actionMachine.stateName}");
        }

        if (animator != null && (eventTypes & ActionMachineEvent.AnimChanged) != 0)
        {
            StateConfig config = actionMachine.GetStateConfig();

            float  fixedTimeOffset = actionMachine.animStartTime;
            float  fadeTime        = config.fadeTime;
            string animName        = actionMachine.GetAnimName();

            if ((eventTypes & ActionMachineEvent.HoldAnimDuration) != 0)
            {
                fixedTimeOffset = animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
            }

            animator.CrossFadeInFixedTime(animName, fadeTime, 0, fixedTimeOffset);
            animator.Update(0);
        }
    }
Exemplo n.º 2
0
 public override string ToString()
 {
     return($"动作节点:{actionMachine.configName}-{actionMachine.GetStateConfig().stateName}-{config.GetType().Name}-{actionMachine.GetStateFrameIndex()}");
 }