示例#1
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (onExit)
        {
            if (useTransformForward && !additive)
            {
                direction = animator.transform.forward;
            }

            if (useTransformForward && additive)
            {
                direction += animator.transform.forward;
            }

            if (states == null)
            {
                states = animator.transform.GetComponent <StateManager>();
            }

            if (!states.isPlayer)
            {
                return;
            }

            if (ply == null)
            {
                ply = animator.transform.GetComponent <HandleMovement_Player>();
            }

            ply.AddVelocity(direction, life, force, onEndClampVelocity);
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        tpCamera = Camera.main.GetComponent <ThirdPersonCamera>();
        gameObject.AddComponent <HandleMovement_Player>();

        states = GetComponent <StateManager>();
        hMove  = GetComponent <HandleMovement_Player>();

        states.isPlayer = true;
        states.Init();
        hMove.Init(states, this);

        FixPlayerMeshes();
    }