Example #1
0
    protected override void OnUpdate()
    {
        ProcessMoveDirection();
        ProcessLookDirection();

        if (Pressed(GetKey(ButtonType.R1)))
        {
            LastInputTime = Time.time;
            _playerShip.FireBeam();
        }
        else if (Pressed(GetKey(ButtonType.L1)))
        {
            LastInputTime = Time.time;
            _playerShip.FireMissiles();
        }
        else if (Mathf.Abs(Input.GetAxisRaw(GetKey(AxisType.R2L2))) > 0.5f)
        {
            LastInputTime = Time.time;
            _playerShip.FireBomb();
        }

        if (Pressed(GetKey(ButtonType.Y)))
        {
            _playerShip.Blink(LeftStick.sqrMagnitude > 0 ? LeftStick : transform.up.ToVec2());
        }
    }
 private void ProcessActions()
 {
     if (Input.GetButton(ACTION_A))
     {
         LastInputTime = Time.time;
         _playerShip.FireBeam();
     }
     else if (Input.GetButton(ACTION_D))
     {
         _playerShip.Blink(Direction.sqrMagnitude > 0 ? Direction : transform.up.ToVec2());
     }
     else if (Input.GetButton((ACTION_C)))
     {
         _playerShip.FireMissiles();
     }
     else if (Input.GetKey(KeyCode.E))
     {
         LastInputTime = Time.time;
         _playerShip.FireBomb();
     }
 }