using System;
using ColdMint.scripts.debug;
using Godot;
namespace ColdMint.scripts.stateMachine;
///
/// Context of the state machine
/// 状态机的上下文环境
///
public class StateContext
{
private State _currentState;
///
/// The state context holds the current state
/// 状态上下文持有当前状态
///
public State CurrentState
{
get => _currentState;
set
{
if (_currentState == value)
{
LogCat.LogWarning("try_to_set_the_same_state");
return;
}
OnStateChange?.Invoke(_currentState, value);
_currentState = value;
}
}
///
/// When the state changes
/// 当状态改变时
///
public Action? OnStateChange;
///
/// owner
/// 主人
///
public Node? Owner { get; set; }
}