Behavior actor functions
Jump to navigation
Jump to search
- clearscope Behavior FindBehavior(class<Behavior> type) const
- Returns the specified Behavior if it exists, otherwise returning null.
- type
- The type of Behavior to look for. This is exact and can't return child classes. A BehaviorIterator should be used for getting all child class types on a given Actor.
- bool RemoveBehavior(class<Behavior> type)
- Removes the given behavior if it exists. Returns true if it was removed or false if nothing was removed.
- type
- The type of Behavior to remove. This is exact and won't remove child classes. ClearBehaviors() passed with a type should be used for that.
- Behavior AddBehavior(class<Behavior> type)
- Adds a new Behavior to the Actor, returning the Behavior it either created or found. Calls Initialize() if created and Reinitialize() if it already existed.
- type
- The type of Behavior to add.
- void TickBehaviors()
- Calls Tick() on all the Actor's existing Behaviors. This is normally done automatically but if an Actor has a full Tick() override or more control is desired for when Behaviors can tick, this can be used to handle this.
- void ClearBehaviors(class<Behavior> type = null)
- Removes all Behaviors the Actor currently has.
- type
- If not null, only remove classes of this type. Note that if null is passed, the removal will be absolute and any residual Behaviors after clean up will be automatically removed as well.
- void MoveBehaviors(Actor from)
- Transfers all the Behaviors from an existing Actor to this one and calls TransferredOwner() in the process.
- from
- The Actor to transfer the Behaviors from.