-
Notifications
You must be signed in to change notification settings - Fork 4
Human Wander Task
The HumanWanderTask is the primary logic added to the human entity AITaskComponent in the EngineerFactory. It manages the behaviour of the engineer entity, and includes the HumanWaitTask, HumanMovementTask and EngineerCombatTask subtasks. All engineer movement, detection of mobs, attacking, taking damage, and death are managed through this task or its subtasks.
The death of engineer entities is linked to game loss state. When the task logic detects that the entity has died, it updates the GameEndService.
Instantiation of the HumanWanderTask requires two arguments, float waitTime
which determines the wait delay, and float maxRange
which sets the detection and attacking range of engineer entities. For example, after defining an engineer entity and adding an AITaskComponent:
(Example from EngineerFactory)
Entity engineer = createBaseHumanNPC();
AITaskComponent aiComponent = new AITaskComponent();
engineer.addComponent(aiComponent);
engineer.getComponent(AITaskComponent.class).addTask(new HumanWanderTask(COMBAT_TASK_PRIORITY, ENGINEER_RANGE));
The following sequence diagram shows an example lifecycle of HumanWanderTask and its subtasks
The following UML Diagram shows the Class structure of HumanWanderTask and its subtasks.