Class PersonAi
This class holds the artificial intelligence implementation for a PersonLike. The AI automatically selects actions based on their ActionType.AiSettings.
public class PersonAi : GenericDataHolder, IGenericDataHolder
- Inheritance
-
GenericDataHolderPersonAi
- Implements
-
IGenericDataHolder
- Inherited Members
-
GenericDataHolder.GetDataKeys()
- Extension Methods
Methods
StartAutomatically(PersonLike, ActionType, bool, bool, params ActionArgument[])
Causes a person to start the given action automatically with the same behavior that it would have if started by the PersonAi
public static bool StartAutomatically(PersonLike person, ActionType type, bool forcePriority = false, bool force = false, params ActionArgument[] chosenArguments)
Parameters
personPersonLikeThe person who should start the action
typeActionTypeThe action to start
forcePriorityboolWhether to add this action to the start of the action queue rather than the end, regardless of the return value of EnqueuePriority.
forceboolWhether to force-start the action. This is passed to EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]).
chosenArgumentsActionArgument[]The set of ActionArgument values to pass to EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]). If this is empty or null, arguments will automatically be generated randomly.
Returns
- bool
Whether the action was successfully started
Events
OnUpdate
An event that is invoked when a PersonAi instance is updated, in Update(GameTime, TimeSpan, float). This event allows mods to change the various cooldowns used by the AI, as well as whether the AI should currently be considered disabled. It also allows adding new actions to a person's ActionQueue through the EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]) method.
public static event PersonAi.UpdateDelegate OnUpdate