The Agent class now provides an API for AgentTask scheduling, which is performed in the background using the AgentTaskManager class. Useful shortcut-methods are provided to trigger task scheduling, including: RunTo(Vector3), PlayAnimation(string), WaitForSeconds(float) as well as more generic methods such as AddTask(IAgentTask) and ForceTask(IAgentTask).
The previously public method RequestNextTask() is now only available to the agents, who exercise an exclusive right of removing tasks from their own queues.
All of the currently implemented task types are independent classes deriving from IAgentTask. In order to implement IAgentTask, the following is required:
Execute(Agent) method, which executes the corresponding task on a particular agent;
Update() method, which is used to perform frame-based task logic on a particular agent;
OnTaskFinished event, which signalizes to the agent that the task has been executed.
The code in the Agent script is neatly organized in two namespaces: VirtualAgentsFramework and its subspace AgentTasks. The AgentController script offers an example task queue for the "Capsule" agent in the project's AvatarTestScene.
The Agent class now provides an API for AgentTask scheduling, which is performed in the background using the AgentTaskManager class. Useful shortcut-methods are provided to trigger task scheduling, including: RunTo(Vector3), PlayAnimation(string), WaitForSeconds(float) as well as more generic methods such as AddTask(IAgentTask) and ForceTask(IAgentTask).
The previously public method RequestNextTask() is now only available to the agents, who exercise an exclusive right of removing tasks from their own queues.
All of the currently implemented task types are independent classes deriving from IAgentTask. In order to implement IAgentTask, the following is required:
The code in the Agent script is neatly organized in two namespaces: VirtualAgentsFramework and its subspace AgentTasks. The AgentController script offers an example task queue for the "Capsule" agent in the project's AvatarTestScene.