예제 #1
0
 public bool GetButtonUp(PlayerIndex playerIndex, Ds4Button btn)
 {
     if (playerIndex == PlayerIndex.Two || playerIndex == PlayerIndex.One)
     {
         return(_joystickInstance.GetButtonUp(playerIndex, btn));
     }
     else
     {
         return(_joystickInstance.GetButtonUp(playerIndex, btn) || _keyboardInstance.GetButtonUp(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;
            }
        }
    }