19 lines
423 B
C#
Raw Normal View History

2020-03-15 23:18:29 +01:00
using UnityEngine;
using UnityAtoms.FSM;
2020-03-18 02:04:33 +01:00
namespace UnityAtoms.Examples
2020-03-15 23:18:29 +01:00
{
2020-03-18 02:04:33 +01:00
public class GameStateDispatcher : MonoBehaviour
2020-03-15 23:18:29 +01:00
{
2020-03-18 02:04:33 +01:00
[SerializeField]
private FiniteStateMachineReference _gameStateRef;
public void DispatchGameOverIfDead(int health)
2020-03-15 23:18:29 +01:00
{
2020-03-18 02:04:33 +01:00
if (health <= 0)
{
_gameStateRef.Machine.Dispatch("SetGameOver");
}
2020-03-15 23:18:29 +01:00
}
}
2020-03-18 02:04:33 +01:00
}