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;
        }
Exemple #2
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.isFacingForward())
            {
                if (control.MoveLeft)
                {
                    animator.SetBool(TransitionParameter.RunningTurn180.ToString(), true);
                }
            }

            if (!control.isFacingForward())
            {
                if (control.MoveRight)
                {
                    animator.SetBool(TransitionParameter.RunningTurn180.ToString(), true);
                }
            }
        }
Exemple #3
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.MoveRight = true;
                control.MoveLeft  = false;
            }
            else
            {
                control.MoveLeft  = true;
                control.MoveRight = false;
            }


            // Debug.Log(dir);
        }
        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));
            }
        }
Exemple #5
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.isFacingForward())
            {
                if (control.transform.position.z < control.aiProgress.findingAgent.endSphere.transform.position.z)
                {
                    control.MoveRight = true;
                    control.MoveLeft  = false;
                }
                else
                {
                    control.MoveRight = false;
                    control.MoveLeft  = false;

                    animator.gameObject.SetActive(false);
                    animator.gameObject.SetActive(true);
                }
            }
            else
            {
                if (control.transform.position.z > control.aiProgress.findingAgent.endSphere.transform.position.z)
                {
                    control.MoveRight = false;
                    control.MoveLeft  = true;
                }
                else
                {
                    control.MoveRight = false;
                    control.MoveLeft  = false;

                    animator.gameObject.SetActive(false);
                    animator.gameObject.SetActive(true);
                }
            }
        }
        public override void OnExit(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            control.animationProgress.AirMomentum = 0f;
        }
Exemple #7
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);
            Vector3          dist    = control.aiProgress.findingAgent.startSphere.transform.position - control.transform.position;

            //Jumping, if startsphere is on lower platform than endphere

            if (control.aiProgress.findingAgent.startSphere.transform.position.y
                < control.aiProgress.findingAgent.endSphere.transform.position.y)
            {
                if (Vector3.SqrMagnitude(dist) < 0.01f)
                {
                    control.MoveLeft  = false;
                    control.MoveRight = false;

                    animator.SetBool(EnemyTransitions.JumpPlatform.ToString(), true);
                }
            }

            //Fall, if endsphere is on lower platform than startsphere

            if (control.aiProgress.findingAgent.startSphere.transform.position.y
                > control.aiProgress.findingAgent.endSphere.transform.position.y)
            {
                animator.SetBool(EnemyTransitions.FallPlatform.ToString(), true);
            }

            //Go straignt if Endsphere and startphare are on same platform

            if (control.aiProgress.findingAgent.startSphere.transform.position.y
                == control.aiProgress.findingAgent.endSphere.transform.position.y)
            {
                if (Vector3.SqrMagnitude(dist) < 0.7f)
                {
                    control.MoveLeft  = false;
                    control.MoveRight = false;

                    Vector3 playerDist = control.transform.position - CharacterManager.Instance.GetPlayableCharacter().transform.position;
                    if (playerDist.sqrMagnitude > 1f)
                    {
                        animator.gameObject.SetActive(false);
                        animator.gameObject.SetActive(true);
                    }
                    //temp attack

                    /*  else
                     * {
                     *    if(CharacterManager.Instance.GetPlayableCharacter().damageDetector.DamageTaken == 0)
                     *    {
                     *        if(control.isFacingForward())
                     *        {
                     *            control.MoveRight = false;
                     *            control.MoveLeft = false;
                     *            control.Attack = true;
                     *        }
                     *        else
                     *        {
                     *            control.MoveRight = false;
                     *            control.MoveLeft = false;
                     *            control.Attack = true;
                     *        }
                     *    }
                     *    else
                     *    {
                     *        control.Attack = false;
                     *        control.MoveLeft = false;
                     *        control.MoveRight = false;
                     *    }
                     *
                     * }*/
                }
            }
        }
Exemple #8
0
 public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
 {
     CharacterControl control = characterState.GetCharacterControl(animator);
 }
Exemple #9
0
 public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
 {
     CharacterControl control = characterState.GetCharacterControl(animator);
 }
Exemple #10
0
        public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            control.animationProgress.thisAllowEarlyTurn = true;
        }