31 lines
663 B
C#
31 lines
663 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class RoomReward : MonoBehaviour
|
|
{
|
|
public static event Action<int> DiamondsRewarded;
|
|
public static event Action ChestRewarded;
|
|
public static event Action<int> DamageDealt;
|
|
|
|
[SerializeField] private int diamonds;
|
|
[SerializeField] private bool chest;
|
|
[SerializeField] private int damage;
|
|
|
|
public void TriggerGetReward()
|
|
{
|
|
if (diamonds > 0)
|
|
{
|
|
DiamondsRewarded?.Invoke(diamonds);
|
|
}
|
|
|
|
if (chest)
|
|
{
|
|
ChestRewarded?.Invoke();
|
|
}
|
|
|
|
if (damage > 0)
|
|
{
|
|
DamageDealt?.Invoke(damage);
|
|
}
|
|
}
|
|
}
|