Skip to main content

AiHook<T>

An abstract class in Root.Township, Alta.Intelligence.

Base for a component that hooks an effect onto an action: placed next to an ActionComponent, it runs Used whenever any creature starts that action and FinishedOrCancelled when it ends.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private bool isEndCalledOnCancelledWhether FinishedOrCancelled runs when the action is cancelled. Default true.
private bool isEndCalledOnFinishedWhether FinishedOrCancelled runs when the action finishes. Default true.

Methods​

MemberWhat it is
protected virtual void FinishedOrCancelled(IActiveAction finished)Called when a creature's run of the action ends. Unhooks itself; subclasses undo their effect here.
protected virtual void Used(IActiveAction active)Called when a creature starts the action. Hooks FinishedOrCancelled onto the finish and cancel events as set.
1 private and internal method
MemberWhat it is
private void Alta.Intelligence.IAiHook.Initialize()Subscribes Used to the sibling action component's Used event. Called on first use of the action.