14 lines
428 B
C#
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
|
|
}
|
|
}
|
|
}
|