mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 00:25:54 +00:00
Visualization for ammo
This commit is contained in:
parent
ed6e659d23
commit
07ab64a0bf
12 changed files with 252 additions and 102 deletions
|
|
@ -19,7 +19,16 @@ public partial class Weapon : Node2D
|
|||
|
||||
public int Ammo { get; set; } = 0;
|
||||
|
||||
public int LoadedAmmo { get; private set; }
|
||||
private int _loadedAmmo;
|
||||
public int LoadedAmmo
|
||||
{
|
||||
get => _loadedAmmo;
|
||||
private set
|
||||
{
|
||||
_loadedAmmo = value;
|
||||
_inventoryManager?.NotifyLoadedAmmoChange(WeaponData?.ItemKey, _loadedAmmo);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 ShootDirection { get; set; } = Vector2.Zero;
|
||||
|
||||
|
|
@ -61,7 +70,7 @@ public partial class Weapon : Node2D
|
|||
{
|
||||
// if (_inventoryManager.GetItemCount(WeaponData.AmmoKey) <= 0) return;
|
||||
var ammoToLoad = _inventoryManager.RemoveItem(WeaponData.AmmoKey, WeaponData.BulletCapacity);
|
||||
|
||||
|
||||
if (ammoToLoad > 0)
|
||||
{
|
||||
LoadedAmmo = ammoToLoad;
|
||||
|
|
@ -127,7 +136,13 @@ public partial class Weapon : Node2D
|
|||
}
|
||||
|
||||
LoadedAmmo -= 1;
|
||||
//_inventoryManager.NotifyLoadedAmmoChange(WeaponData.ItemKey, LoadedAmmo);
|
||||
// if (!string.IsNullOrWhiteSpace(WeaponData?.AmmoKey))
|
||||
// {
|
||||
// // Notify hud to decrease weapon
|
||||
//
|
||||
// }
|
||||
|
||||
_cooldownTimer.Start(WeaponData.RateOfFire);
|
||||
_cooldownTimer.Start(WeaponData?.RateOfFire ?? 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue