First project upload
This commit is contained in:
25
Assets/New Lowpoly Models/Scripts/DroppedCash.cs
Normal file
25
Assets/New Lowpoly Models/Scripts/DroppedCash.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user