Skip to main content

Dragonfly

A class in Root.Township, Alta.Intelligence.

Creature class for the dragonfly and the Dais herd animals: a body, a view cone, a passive set and a stunned action. Server AI; Killed runs on both sides.

Constructors​

MemberWhat it is
Dragonfly()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private Transform bodyTransform whose position is the creature's Position.
private string killedAnimatorBooleanAnimator bool set on death. Default "Killed".
private ActionComponentSet passiveActionsThe action set the creature starts with.
private static Dictionary<ActionComponentSet, ActionSet<Dragonfly>> passiveActionSetMapStatic cache of the action set built from each passive set asset.
private ActionComponent stunnedActionThe action component for the stunned action.
private static Dictionary<ActionComponent, ActionTarget<Dragonfly>> stunnedActionMapStatic cache of the stunned action built from each action component.
private ViewCone viewConeBacking field for ViewCone.

Properties​

MemberWhat it is
override Vector3 Position { get; }The body transform's position.
ActionTarget<Dragonfly> Stunned { get; private set; }The stunned action, with no target.
ViewCone ViewCone { get; }The creature's view cone, used by view cone senses and actions.

Methods​

MemberWhat it is
void Stun(float strength)Server: starts the stunned action. strength is ignored. Called by a StatTrigger on the prefab.
protected override void InitializeAi()Server: picks the passive set and the stunned action, building each once per asset.
protected override void InitializeStatic()Creates the shared set and stunned action caches, once per class.
protected override void Killed(HealthObject healthobject)Turns off collision and sets the killed animator bool on the local animator.