コード例 #1
0
 public void SetDefaultWeapon()
 {
     _backpack.Add(Weapon.CreatePistol());
     currentWeapon = _backpack[0];
     Shooting.SetCurrentWeapon();
     PlayerWeaponSwitch.SetCurrentWeapon();
     HUD.SetCurrentWeapon();
 }
コード例 #2
0
    public static void PreviousWeapon()
    {
        int i = _currentWeaponIndex - 1;

        if (i >= 0)
        {
            currentWeapon = _backpack[i];
            Shooting.SetCurrentWeapon();
            PlayerWeaponSwitch.SetCurrentWeapon();
            HUD.SetCurrentWeapon();
            HUD.UpdateWeaponDisplay();
            _currentWeaponIndex = i;
        }
    }
コード例 #3
0
    public static void NextWeapon()
    {
        int i = _currentWeaponIndex + 1;
        int lastPossibleIndex = _backpack.Count;

        if (i <= lastPossibleIndex - 1)
        {
            if (_backpack[i] != null)
            {
                currentWeapon = _backpack[i];
                Shooting.SetCurrentWeapon();
                PlayerWeaponSwitch.SetCurrentWeapon();
                HUD.SetCurrentWeapon();
                HUD.UpdateWeaponDisplay();
                _currentWeaponIndex = i;
            }
        }
    }