Skip to main content

ActiveIdle

A class in Root.Township, Alta.Intelligence.

The running idle action for an agent, made from AgentIdleSettings. It waits a random duration and can turn to face or follow the target while it does.

Constructors​

MemberWhat it is
ActiveIdle()Creates an ActiveIdle with default values.

Fields​

2 private and internal fields
MemberWhat it is
private bool isSlowingThe walker's IsSlowedWhenNotMoving value from before the idle, put back when it ends.
private float startTimeReal time the idle started, used for the follow and facing time windows.

Methods​

MemberWhat it is
static BasicAction<Agent, ActiveIdle, AgentIdleSettings> GetAction(AgentIdleSettings settings)Builds the idle action for the given settings, copying their IsUsingTarget flag.
override void Update(bool hasTarget)While the target exists, faces it and follows it inside the configured time windows; otherwise stops the director.
protected override void OnStart()Maybe asks the population to move the spawn, sets a random duration, records the start time and hooks the finish handlers when facing the target.
1 private and internal method
MemberWhat it is
private void OnFinished(IActiveAction finished)Restores the walker's slow-down flag and stops the director's facing and movement when the idle ends or is cancelled.

Used in​

Members of other types that take, return or hold a ActiveIdle: