24 lines
599 B
C#
24 lines
599 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class TurnSystem : MonoBehaviour {
|
|
public static TurnSystem Instance { get; private set; }
|
|
public int TurnNumber { get; private set; } = 1;
|
|
|
|
private void Awake() {
|
|
if (Instance is not null) {
|
|
Debug.LogError($"There is more than one TurnSystem! {transform} - {Instance}");
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
Instance = this;
|
|
}
|
|
|
|
public event EventHandler OnTurnChanged;
|
|
|
|
public void NextTurn() {
|
|
TurnNumber++;
|
|
OnTurnChanged?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
} |