This commit is contained in:
Alex38Lyon
2025-06-03 12:00:47 +02:00
parent ed8041abcd
commit 878ea46cac
1300 changed files with 527178 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
using Unity.FPS.Game;
using UnityEngine;
namespace Unity.FPS.Gameplay
{
public class AmmoPickup : Pickup
{
[Tooltip("Weapon those bullets are for")]
public WeaponController Weapon;
[Tooltip("Number of bullets the player gets")]
public int BulletCount = 30;
protected override void OnPicked(PlayerCharacterController byPlayer)
{
PlayerWeaponsManager playerWeaponsManager = byPlayer.GetComponent<PlayerWeaponsManager>();
if (playerWeaponsManager)
{
WeaponController weapon = playerWeaponsManager.HasWeapon(Weapon);
if (weapon != null)
{
weapon.AddCarriablePhysicalBullets(BulletCount);
AmmoPickupEvent evt = Events.AmmoPickupEvent;
evt.Weapon = weapon;
EventManager.Broadcast(evt);
PlayPickupFeedback();
Destroy(gameObject);
}
}
}
}
}