Implemented basic room rewards triggering mechanism.
This commit is contained in:
parent
9a8077021a
commit
90b9e2689a
5 changed files with 1060 additions and 2 deletions
31
PuzzleGameProject/Assets/Scripts/Rooms/RoomReward.cs
Normal file
31
PuzzleGameProject/Assets/Scripts/Rooms/RoomReward.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue