Пример #1
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.Jump)
            {
                animator.SetBool(TransitionParameter.Jump.ToString(), true);
            }

            if (Constant)
            {
                ConstantMove(control, animator, stateInfo);
            }
            else
            {
                ControlledMove(control, animator, stateInfo);
            }
        }
Пример #2
0
        public void RegisterAttack(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            if (StartAttackTime <= stateInfo.normalizedTime && EndAttackTime > stateInfo.normalizedTime)
            {
                foreach (AttackInfo info in AttackManager.Instance.CurrentAttacks)
                {
                    if (info == null)
                    {
                        continue;
                    }

                    if (!info.IsRegistered && info.AttackAbility == this)
                    {
                        info.Register(this, characterState.GetCharacterControl(animator));
                    }
                }
            }
        }
Пример #3
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.Jump)
            {
                animator.SetBool(TransitionParameter.Jump.ToString(), true);
            }

            if (control.MoveRight)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), true);
            }

            if (control.MoveLeft)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), true);
            }
        }
Пример #4
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            Debug.Log(control.MoveForward);
            if (control.MoveRight && control.MoveLeft && control.MoveForward)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), false);
                return;
            }

            if (!control.MoveRight && !control.MoveLeft && !control.MoveForward)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), false);
                return;
            }
            if (control.MoveForward)
            {
                control.transform.Translate(Vector3.forward * Speed * Time.deltaTime);
                //control.transform.rotation = Quaternion.Euler(0f, 0f, 0f); // change direction forward
            }
            if (control.MoveRight)
            {
                //Debug.Log(control.MoveForward);
                control.transform.Translate(Vector3.right * Speed * Time.deltaTime);
                //control.transform.rotation = Quaternion.Euler(0f, 0f, 0f); // change direction forward
            }



            if (control.MoveLeft)
            {
                control.transform.Translate(Vector3.left * Speed * Time.deltaTime);
                //control.transform.rotation = Quaternion.Euler(0f, 180f, 0f); // change direction backward
            }
        }
Пример #5
0
        public override void OnExit(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            control.GravityMultiplier = 0f;
        }
Пример #6
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            control.GravityMultiplier = Gravity.Evaluate(stateInfo.normalizedTime);
        }
Пример #7
0
 public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
 {
     characterState.GetCharacterControl(animator).RIGID_BODY.AddForce(Vector3.up * JumpForce);
     animator.SetBool(TransitionParameter.Grounded.ToString(), false);
 }
Пример #8
0
 public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
 {
     characterState.GetCharacterControl(animator).RIGID_BODY.AddForce(Vector3.up * JumpForce);
 }