Ejemplo n.º 1
0
        // 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, useForceCurve, forceCurve);
            }
        }
Ejemplo n.º 2
0
        // Start is called before the first frame update
        void Start()
        {
            //Add references
            gameObject.AddComponent <HandleMovement_Player>();

            //Get references
            CamManager = CameraManager.singleton;
            states     = GetComponent <StateManager>();
            hMove      = GetComponent <HandleMovement_Player>();

            CamManager.target = this.transform;

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

            FixPlayerMeshes();
        }