Implemented chest pop up and gaining ability upon completing a room with a chest reward.
This commit is contained in:
parent
90b9e2689a
commit
fdeab50984
15 changed files with 1185 additions and 997 deletions
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ChestRewardSelection : MonoBehaviour
|
||||
{
|
||||
public static event Action DiamondAndLifeSelected;
|
||||
public static event Action TorchAbilitySelected;
|
||||
public static event Action BlackDiceAbilitySelected;
|
||||
|
||||
[SerializeField] private Button diamondAndLifeButton;
|
||||
[SerializeField] private Button torchButton;
|
||||
[SerializeField] private Button blackDiceButton;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
RoomReward.ChestRewarded += HandChestRewarded;
|
||||
diamondAndLifeButton.onClick.AddListener(HandleDiamondAndLifeSelected);
|
||||
torchButton.onClick.AddListener(HandleTorchSelected);
|
||||
blackDiceButton.onClick.AddListener(HandleBlackDiceSelected);
|
||||
}
|
||||
|
||||
private void HandChestRewarded()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void HandleDiamondAndLifeSelected()
|
||||
{
|
||||
diamondAndLifeButton.interactable = false;
|
||||
DiamondAndLifeSelected?.Invoke();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void HandleTorchSelected()
|
||||
{
|
||||
torchButton.interactable = false;
|
||||
TorchAbilitySelected?.Invoke();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void HandleBlackDiceSelected()
|
||||
{
|
||||
blackDiceButton.interactable = false;
|
||||
BlackDiceAbilitySelected?.Invoke();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue