25 lines
480 B
C#
25 lines
480 B
C#
using UnityEngine;
|
|
|
|
public class DroppedCash : MonoBehaviour
|
|
{
|
|
private int value;
|
|
|
|
public void SetValue(int amount)
|
|
{
|
|
value = amount;
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (!other.CompareTag("Player"))
|
|
return;
|
|
|
|
CashManager cashManager = other.GetComponent<CashManager>();
|
|
|
|
if (cashManager != null)
|
|
{
|
|
cashManager.AddCash(value);
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
} |