NPCs/Implementation/Crackhead/AlertState.cs
namespace Opium.AI;
public partial class AlertState : StateMachine.State
{
public override void Tick()
{
// Look at the current stimuli location
Agent.LookAt( Agent.LastStimulus.Position );
}
public override float RequiredEntryScore => 100f;
/// <summary>
/// We can enter the Alert state from the following states.
/// </summary>
public override List<Type> FromStates => new()
{
typeof( IdleState ),
typeof( PatrolState )
};
public override float EntryScore
{
get
{
// We only want to be alerted if something actually happened
if ( Agent.LastStimulus is null ) return 0f;
if ( Agent.LastStimulus.HasExpired ) return 0f;
return RequiredEntryScore;
}
}
}