public InputEntry(int playerIndex, PlayerInput input)
 {
     this.playerIndex = playerIndex;
     this.input = input;
 }
Ejemplo n.º 2
0
        public void OnActionReleased(PlayerInput playerInput, PlayerAction action)
        {
            switch (action)
            {
                case PlayerAction.Left:
                case PlayerAction.Right:
                case PlayerAction.Up:
                case PlayerAction.Down:
                    StopMoving();
                    break;
            }

            if (playerInput.GetPressedActionCount() > 0)
            {
                if (playerInput.IsActionPressed(PlayerAction.Up))
                {
                    StartMovingToDirection(Direction.UP);
                }
                else if (playerInput.IsActionPressed(PlayerAction.Down))
                {
                    StartMovingToDirection(Direction.DOWN);
                }

                if (playerInput.IsActionPressed(PlayerAction.Left))
                {
                    StartMovingToDirection(Direction.LEFT);
                }
                else if (playerInput.IsActionPressed(PlayerAction.Right))
                {
                    StartMovingToDirection(Direction.RIGHT);
                }
            }

            if (action == PlayerAction.Bomb)
            {
                TryThrowBomb();
            }
        }
Ejemplo n.º 3
0
 public void SetPlayerInput(PlayerInput input)
 {
     this.m_input = input;
 }
Ejemplo n.º 4
0
        public void OnActionPressed(PlayerInput playerInput, PlayerAction action)
        {
            switch (action)
            {
                case PlayerAction.Up:
                {
                    StartMovingToDirection(Direction.UP);
                    break;
                }

                case PlayerAction.Down:
                {
                    StartMovingToDirection(Direction.DOWN);
                    break;
                }

                case PlayerAction.Left:
                {
                    StartMovingToDirection(Direction.LEFT);
                    break;
                }

                case PlayerAction.Right:
                {
                    StartMovingToDirection(Direction.RIGHT);
                    break;
                }

                case PlayerAction.Bomb:
                {
                    TryAction();
                    break;
                }

                case PlayerAction.Special:
                {
                    TrySpecialAction();
                    break;
                }
            }
        }