61 lines
1.4 KiB
C#
61 lines
1.4 KiB
C#
using Chickensoft.Introspection;
|
|
using static Zennysoft.Game.Ma.EnemyLogic.Input;
|
|
|
|
namespace Zennysoft.Game.Ma;
|
|
|
|
public partial class EnemyLogic
|
|
{
|
|
public partial record State
|
|
{
|
|
[Meta, Id("enemy_logic_state_alive")]
|
|
public abstract partial record Alive : State,
|
|
IGet<Idle>,
|
|
IGet<Move>,
|
|
IGet<Patrol>,
|
|
IGet<Follow>,
|
|
IGet<Flee>,
|
|
IGet<ReachedPlayer>,
|
|
IGet<Input.LoseTrackOfTarget>,
|
|
IGet<Input.Defeated>
|
|
{
|
|
public Transition On(in Reset input)
|
|
{
|
|
Output(new Output.ReturnToDefaultState());
|
|
return ToSelf();
|
|
}
|
|
|
|
public Transition On(in Input.Defeated input) => To<Defeated>();
|
|
|
|
public Transition On(in Follow _) => To<FollowPlayer>();
|
|
|
|
public Transition On(in Flee _) => To<FleePlayer>();
|
|
|
|
public Transition On(in LoseTrackOfTarget input)
|
|
{
|
|
Output(new Output.ReturnToDefaultState());
|
|
return To<Unactivated>();
|
|
}
|
|
|
|
public Transition On(in ReachedPlayer input)
|
|
{
|
|
Output(new Output.Idle());
|
|
return To<EngagePlayer>();
|
|
}
|
|
|
|
public Transition On(in Patrol _) => To<Patrolling>();
|
|
|
|
public Transition On(in Idle input)
|
|
{
|
|
Output(new Output.Idle());
|
|
return ToSelf();
|
|
}
|
|
|
|
public Transition On(in Move input)
|
|
{
|
|
Output(new Output.Move());
|
|
return ToSelf();
|
|
}
|
|
}
|
|
}
|
|
}
|