Class WanderTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.WanderTask
- All Implemented Interfaces:
- PriorityTask,- Task
Represents a task that causes the entity to wander around by moving to random positions within a specified range of its starting position.
 The entity will wait for a certain amount of time between movements. Requires an entity with a PhysicsMovementComponent.
- 
Nested Class SummaryNested classes/interfaces inherited from interface com.csse3200.game.ai.tasks.TaskTask.Status
- 
Field SummaryFields inherited from class com.csse3200.game.ai.tasks.DefaultTaskowner, status
- 
Constructor SummaryConstructorsConstructorDescriptionWanderTask(com.badlogic.gdx.math.Vector2 wanderRange, float waitTime) Creates a new WanderTask.
- 
Method SummaryModifier and TypeMethodDescriptionchargetDirection(com.badlogic.gdx.math.Vector2 destination) Determines the direction from the entity's current position to the destination position.intvoidstart()Start running this task.voidupdate()Run one frame of the task.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTaskcreate, getStatus, stop
- 
Constructor Details- 
WanderTaskpublic WanderTask(com.badlogic.gdx.math.Vector2 wanderRange, float waitTime) Creates a new WanderTask.- Parameters:
- wanderRange- The distance in X and Y that the entity can move from its position when start() is called.
- waitTime- The duration in seconds to wait between wandering.
 
 
- 
- 
Method Details- 
getPrioritypublic int getPriority()- Specified by:
- getPriorityin interface- PriorityTask
 
- 
startpublic void start()Description copied from interface:TaskStart running this task. This will usually be called by an AI controller.- Specified by:
- startin interface- Task
- Overrides:
- startin class- DefaultTask
 
- 
updatepublic void update()Description copied from interface:TaskRun one frame of the task. Similar to the update() in Components.- Specified by:
- updatein interface- Task
- Overrides:
- updatein class- DefaultTask
 
- 
getDirectionpublic char getDirection(com.badlogic.gdx.math.Vector2 destination) Determines the direction from the entity's current position to the destination position.- Parameters:
- destination- The destination position to which the direction is calculated.
- Returns:
- A character representing the direction ('<', '>', or '=') relative to the current position.
 
 
-