2020-03-20 01:29:39 +01:00

22 lines
500 B
C#

using UnityEngine;
using UnityAtoms.FSM;
namespace UnityAtoms.Examples
{
/// <summary>
/// Dispatches commands to the FSM.
/// </summary>
public class GameStateDispatcher : MonoBehaviour
{
[SerializeField]
private FiniteStateMachineReference _gameStateRef;
public void DispatchGameOverIfDead(int health)
{
if (health <= 0)
{
_gameStateRef.Machine.Dispatch("SetGameOver");
}
}
}
}