コード例 #1
0
        protected override void Update()
        {
            //Fix this with animation time
            deltaTime += Time.deltaTime;

            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)
                {
                    deltaTime = 0;
                }
            }
            else if (deltaTime > 0.5f)
            {
                nextState = new AttackL(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();
            }
        }