Example #1
0
        public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.isFacingForward())
            {
                control.FaceForward(false);
            }
            else
            {
                control.FaceForward(true);
            }
        }
Example #2
0
        public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.transform.position.z < control.aiProgress.findingAgent.endSphere.transform.position.z)
            {
                control.FaceForward(true);
            }
            else if (control.transform.position.z > control.aiProgress.findingAgent.endSphere.transform.position.z)
            {
                control.FaceForward(false);
            }
        }
Example #3
0
        public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (AllowEarlyTurn && !control.animationProgress.thisAllowEarlyTurn)
            {
                if (control.MoveLeft)
                {
                    control.FaceForward(false);
                }
                if (control.MoveRight)
                {
                    control.FaceForward(true);
                }
            }

            control.animationProgress.thisAllowEarlyTurn = false;
            control.animationProgress.AirMomentum        = 0f;
        }
Example #4
0
        private void UpdateMomentum(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.MoveRight)
            {
                control.animationProgress.AirMomentum += speedGraph.Evaluate(stateInfo.normalizedTime) * Time.deltaTime;
            }

            if (control.MoveLeft)
            {
                control.animationProgress.AirMomentum -= speedGraph.Evaluate(stateInfo.normalizedTime) * Time.deltaTime;
            }

            if (Mathf.Abs(control.animationProgress.AirMomentum) >= maxMomentum)
            {
                if (control.animationProgress.AirMomentum > 0f)
                {
                    control.animationProgress.AirMomentum = maxMomentum;
                }
                else if (control.animationProgress.AirMomentum < 0f)
                {
                    control.animationProgress.AirMomentum = -maxMomentum;
                }
            }

            if (control.animationProgress.AirMomentum > 0f)
            {
                control.FaceForward(true);
            }
            else if (control.animationProgress.AirMomentum < 0f)
            {
                control.FaceForward(false);
            }
            if (!CheckFront(control))
            {
                control.MoveForward(speed, Mathf.Abs(control.animationProgress.AirMomentum));
            }
        }
Example #5
0
        public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            Vector3 dir = control.aiProgress.findingAgent.startSphere.transform.position - control.transform.position;

            if (dir.z > 0f)
            {
                control.FaceForward(true);
                control.MoveRight = true;
                control.MoveLeft  = false;
            }
            else
            {
                control.FaceForward(false);
                control.MoveLeft  = true;
                control.MoveRight = false;
            }

            control.Running = true;

            // Debug.Log(dir);
        }