Files
CartoonFPS/Assets/Scripts/AmmoPickup.cs
SHOUTING_PIRATE 4c8592d0ab initial commit
2025-08-05 09:30:40 +01:00

14 lines
428 B
C#

using UnityEngine;
public class AmmoPickup : MonoBehaviour
{
public void OnTriggerEnter(Collider other)
{
if(other.CompareTag("Player"))
{
FindFirstObjectByType<WeaponsController>().GetAmmo(); // Call the GetAmmo method from WeaponsController when the player collides with the ammo pickup
Destroy(gameObject); // Destroy the ammo pickup object after collection
}
}
}