예제 #1
0
 public bool GetButton(PlayerIndex playerIndex, Ds4Button btn)
 {
     if (playerIndex == PlayerIndex.Two || playerIndex == PlayerIndex.One)
     {
         return(_joystickInstance.GetButton(playerIndex, btn));
     }
     else
     {
         return(_joystickInstance.GetButton(playerIndex, btn) || _keyboardInstance.GetButton(playerIndex, btn));
     }
 }
예제 #2
0
    private void HandleAim()
    {
        if (_energyHandler.GetPlayerEnergyAmount() > 0)
        {
            if (_joyInputController.GetButtonDown(Index, Ds4Button.Square))
            {
                AimDuration = 0;
                IsAiming    = true;

                _energyHandler.ToogleShield(true);
            }
            if (_joyInputController.GetButton(Index, Ds4Button.Square))
            {
                AimDuration += Time.deltaTime;
                Aim.SetPositions(new[] { Vector3.zero, new Vector3(0, 0, AimDuration) });

                _energyHandler.SetHoldingShot(true, AimDuration);
            }
            else if (_joyInputController.GetButtonUp(Index, Ds4Button.Square))
            {
                Aim.SetPositions(new[] { Vector3.zero, Vector3.zero });
                IsAiming = false;

                _energyHandler.ToogleShield(false);
                _energyHandler.TryToShoot();
                AimDuration = 0;
            }
        }
    }