Пример #1
0
        protected override void Update()
        {
            deltaTime += Time.deltaTime;

            if (commands.Count > 0)
            {
                Command command = commands.Dequeue();

                if (command == Command.AttackR)
                {
                    nextState = new AttackR(base.animationController, base.player, base.baseCharacterInput);
                    Exit();
                }
                else if (command == Command.AttackL)
                {
                    deltaTime = 0;
                }
            }
            else if (deltaTime > 0.5f)
            {
                nextState = new Idle(base.animationController, base.player, base.baseCharacterInput);

                Exit();
            }
        }
Пример #2
0
        protected override void Update()
        {
            Vector2 mag = new Vector2(baseCharacterInput.LeftVerticalAxis, baseCharacterInput.LeftHorizontalAxis);

            Vector2 magRight = new Vector2(baseCharacterInput.RightHorizontalAxis, baseCharacterInput.RightVerticalAxis);

            animationController.TurnAxis(baseCharacterInput.RightHorizontalAxis, baseCharacterInput.RightVerticalAxis);

            if (base.player.GetComponent <TpcCharacterController>().attackValue > 0)
            {
                nextState = new Hit(base.animationController, base.player, base.baseCharacterInput);

                Exit();
            }
            else if (commands.Count > 0)
            {
                Command command = commands.Dequeue();

                if (command == Command.AttackL)
                {
                    nextState = new AttackL(base.animationController, base.player, base.baseCharacterInput);
                    Exit();
                }
                else if (command == Command.AttackR)
                {
                    nextState = new AttackR(base.animationController, base.player, base.baseCharacterInput);
                    Exit();
                }
            }
            else if (DefenceInput())
            {
                nextState = new Defence(base.animationController, base.player, base.baseCharacterInput);

                Exit();
            }
            else if (mag.magnitude != 0)
            {
                nextState = new Run(base.animationController, base.player, base.baseCharacterInput);

                Exit();
            }
        }