Interface IUtilityAction
The base implementation for Utility Action to be used by the planner.
Assembly: UtilityAIFramework.dll
Syntax
public interface IUtilityAction
Properties
Considerations
The list of considerations. Think of a consideration as a question of how much you want to do something.
i.e a consideration for EatAction is how hungry are you? If you are very hungry, it will return 1.
The list of consideration total score average is the Action's Score.
Declaration
List<Consideration> Considerations { get; }
Property Value
Events
A list of unity events for ease of use.
Declaration
UtilityAction.ActionEvents Events { get; }
Property Value
FoldOutEnabled
To show more info, only used for editor purposes.
Declaration
bool FoldOutEnabled { get; set; }
Property Value
Initialized
Set up has been completed so we won't do it a second time.
Declaration
bool Initialized { get; set; }
Property Value
MoveData
The Action Move Data stores useful data to pass to the Move System.
Declaration
ActionMoveData MoveData { get; }
Property Value
Name
The name of the action, mostly used for debugging purposes.
Declaration
Property Value
PropertySet
Declaration
PropertySetRuntime PropertySet { get; }
Property Value
Score
The last evaluated Score of the Action. The higher score will get chosen by the Planner.
Declaration
Property Value
State
The last known state of the action. Useful for debugging purposes.
Declaration
EActionStatus State { get; }
Property Value
TimeWatch
Stores the time elapsed of the performing action.
Declaration
TimeWatcher TimeWatch { get; }
Property Value
Weight
The action score is multiplied by the weight. This determines its max score output and can be use for classifying priorities.
Declaration
Property Value
Methods
IsAvailable()
This is checked before the action is scored. This is useful for simply telling an action to not occur via code.
It's basically a coded approach to considerations.
Declaration
Returns
OnConsiderationCheck(Consideration)
This is called just before a consideration is checked. This gives time for us to bind any neccessary data.
Declaration
void OnConsiderationCheck(Consideration consideration)
Parameters
OnMove(MoveSystemBase)
Called Once Per Frame.
Assign destination to Destination Transform by default.
Override this method to change the target destination, i.e a location without a transform.
You can use this to override Move System or simply modify its speed.
Transform is kept default for convenience sake
Declaration
void OnMove(MoveSystemBase moveSystem)
Parameters
OnMoveStarted(MoveSystemBase)
Is called when the Agent just started moving to its target to perform the action.
Declaration
void OnMoveStarted(MoveSystemBase moveSystem)
Parameters
OnReachedDestination()
Is called when the Agent reached the destination. This is not called if MoveData Required field is not enabled.
Declaration
void OnReachedDestination()
Is called when the action can be executed. i.e within range.
Returning EActionStatus.Completed will end the action and the agent will find a new plan.
Returning EActionStatus.Running will continue.
Returning EActionStatus.Failed will allow to Agent to know to Abort the action.
Declaration
EActionStatus Perform(Agent agent)
Parameters
Type |
Name |
Description |
Agent |
agent |
|
Returns
SetScore(Single)
Declaration
void SetScore(float getRescaleScore)
Parameters
Type |
Name |
Description |
Single |
getRescaleScore |
|
SetState(EActionStatus)
Sets the ActionStatus of the Agent. This does not transition and is used more for tracking.
Declaration
void SetState(EActionStatus state)
Parameters
Setup(Agent)
Sets up the action, useful for any initialization.
Declaration
Parameters
Type |
Name |
Description |
Agent |
agent |
|