コード例 #1
0
 // Use this for initialization
 void Start()
 {
     controls = GetComponent <PlayerMovement>().controls;
     SetPowerup(new PowerupBase.EmptyPowerup(gameObject));
     SetLastingPowerup(new PowerupBase.EmptyPowerup(gameObject));
     _playerID = this.gameObject.GetComponent <PlayerMovement>().playerID;
 }
コード例 #2
0
    void HandleInput()
    {
        PlayerMovement.Controls currentControls = controllerBind? controllerBind.LocalPlayer1Controls : PlayerMovement.Controls.WASD;

        switch (currentControls)
        {
        default:
        case PlayerMovement.Controls.WASD:
            if (Input.GetKeyDown(KeyCode.W))
            {
                MoveButtonPointer(true);
            }
            if (Input.GetKeyDown(KeyCode.S))
            {
                MoveButtonPointer(false);
            }
            if (Input.GetKeyDown(KeyCode.Space))
            {
                OnButtonPress();
            }
            break;

        case PlayerMovement.Controls.ARROWS:
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                MoveButtonPointer(true);
            }
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                MoveButtonPointer(false);
            }
            if (Input.GetKeyDown(KeyCode.L))
            {
                OnButtonPress();
            }
            break;

        case PlayerMovement.Controls.CONTROLLER:
            float axis = TeamUtility.IO.InputManager.GetAxis("Vertical", controllerBind.LocalPlayer1ID);
            if (axis > 0)
            {
                MoveButtonPointer(false);
            }
            if (axis < 0)
            {
                MoveButtonPointer(true);
            }
            if (TeamUtility.IO.InputManager.GetButtonDown("Jump", controllerBind.LocalPlayer1ID))
            {
                OnButtonPress();
            }
            break;
        }
    }