28 lines
856 B
C#

using UnityEngine;
namespace State
{
/// <summary>
/// State that drives the engine. OnEnter, OnUpdate, OnFixedUpdate, and OnExit called by parent state machine
/// </summary>
public class GameState
{
protected Machine StateMachine;
/// <summary>
/// Called when parent state machine loads this state.
/// Gives a reference to the parent state machine to the state.
/// </summary>
/// <param name="machine"></param>
public virtual void OnEnter(Machine machine)
{
StateMachine = machine;
}
// Called when parent StateMachine ChangeState is about to leave this state
public virtual void OnExit() {}
public virtual void OnUpdate(float deltaTime) {}
public virtual void OnFixedUpdate(float deltaTime) {}
}
}