Implemented turn passing and taking damage from it.
This commit is contained in:
parent
31917ba415
commit
ede5ef1533
6 changed files with 572 additions and 15 deletions
36
PuzzleGameProject/Assets/Scripts/PassManager.cs
Normal file
36
PuzzleGameProject/Assets/Scripts/PassManager.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.Video;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
|
||||
public class PassManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button passButton;
|
||||
[SerializeField] private GameManager gameManager;
|
||||
|
||||
public event EventHandler PassRequested;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
passButton.onClick.AddListener(OnPassClicked);
|
||||
gameManager.StateChanged += OnGameStateChange;
|
||||
}
|
||||
|
||||
private void OnGameStateChange(object sender, GameState state) {
|
||||
if (state == GameState.RollDice)
|
||||
{
|
||||
passButton.interactable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
passButton.interactable = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPassClicked()
|
||||
{
|
||||
PassRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue