Skip to main content

ActiveThreaten

A class in Root.Township, Alta.Intelligence.

Action where the agent faces and threatens its target. If the target comes too close it finishes and switches to the ChangeTo action set; if it leaves, it cancels.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private float cancelSquaredSquared distance beyond which the threat is dropped.
private float instantSquaredSquared distance within which the agent reacts at once.

Methods​

MemberWhat it is
override void Update(bool hasTarget)Faces the target if set to, finishes when it is inside the instant distance, cancels past the cancel distance.
protected override void OnStart()Sets a random duration and squares the instant and cancel distances.
2 private and internal methods
MemberWhat it is
private void HandleCancelled(IActiveAction cancelled)Clears the facing target.
private void HandleFinished(IActiveAction finished)Switches the agent to the ChangeTo action set and clears facing.