47 lines
1,013 B
C#
47 lines
1,013 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class RoomRewards : MonoBehaviour
|
|
{
|
|
public static event Action<int> DiamondsRewarded;
|
|
public static event Action ChestRewarded;
|
|
public static event Action<int> DamageDealt;
|
|
|
|
[SerializeField] public int Diamonds = 0;
|
|
[SerializeField] private GameObject diamondsGO;
|
|
[SerializeField] public int Damage = 0;
|
|
[SerializeField] private GameObject chestGO;
|
|
[SerializeField] public bool Chest = false;
|
|
|
|
private void Start()
|
|
{
|
|
if (chestGO != null)
|
|
{
|
|
chestGO.SetActive(Chest);
|
|
}
|
|
|
|
if (diamondsGO != null)
|
|
{
|
|
diamondsGO.SetActive(Diamonds > 0);
|
|
}
|
|
|
|
}
|
|
|
|
public void TriggerGetReward()
|
|
{
|
|
if (Diamonds > 0)
|
|
{
|
|
DiamondsRewarded?.Invoke(Diamonds);
|
|
}
|
|
|
|
if (Chest)
|
|
{
|
|
ChestRewarded?.Invoke();
|
|
}
|
|
|
|
if (Damage > 0)
|
|
{
|
|
DamageDealt?.Invoke(Damage);
|
|
}
|
|
}
|
|
}
|