Added the ability to use a limited number of black dice.
This commit is contained in:
parent
0e869555d3
commit
bcfd42147b
12 changed files with 1058 additions and 26 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using Abilities;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
|
@ -17,13 +19,22 @@ public class Die : MonoBehaviour
|
|||
private Color originalColor;
|
||||
private bool _isClickable = false;
|
||||
private bool _selected = false;
|
||||
private bool _blackDieAbilityUsed = false;
|
||||
public event Action<Die> DieSelected;
|
||||
public event Action<Die> DieUnselected;
|
||||
|
||||
private void Start() {
|
||||
GameManager.Instance.StateChanged += HandleStateChange;
|
||||
dieButton.onClick.AddListener(DiePressed);
|
||||
private void OnEnable() {
|
||||
GameManager.StateChanged += HandleStateChange;
|
||||
BlackDieAbility.AbilitySelected += HandleOnBlackDieAbilitySelected;
|
||||
}
|
||||
|
||||
private void OnDisable() {
|
||||
GameManager.StateChanged -= HandleStateChange;
|
||||
BlackDieAbility.AbilitySelected -= HandleOnBlackDieAbilitySelected;
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
dieButton.onClick.AddListener(DiePressed);
|
||||
originalColor = gameObject.GetComponent<Image>().color;
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +70,7 @@ public class Die : MonoBehaviour
|
|||
|
||||
private void DiePressed()
|
||||
{
|
||||
if (!_isClickable) return;
|
||||
if (!_isClickable || (color == DiceColor.Black && !_blackDieAbilityUsed)) return;
|
||||
|
||||
if (_selected)
|
||||
{
|
||||
|
|
@ -101,4 +112,8 @@ public class Die : MonoBehaviour
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleOnBlackDieAbilitySelected() {
|
||||
_blackDieAbilityUsed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue