Class EnemyMovement
java.lang.Object
com.deco2800.game.ai.tasks.DefaultTask
com.deco2800.game.components.tasks.EnemyMovement
- All Implemented Interfaces:
PriorityTask,Task
AI task to handle enemy movement
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.deco2800.game.ai.tasks.Task
Task.Status -
Field Summary
Fields inherited from class com.deco2800.game.ai.tasks.DefaultTask
owner, status -
Constructor Summary
ConstructorsConstructorDescriptionEnemyMovement(AtlantisTerrainFactory terrainFactory) Creates an EnemyMovement instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates a movement task.com.badlogic.gdx.math.Vector2Returns the destination point of entityintReturns priority of taskcom.badlogic.gdx.math.Vector2Returns the starting position upon spawning of entityvoidvoidsetCurrentTask(Task currentTask) Sets the current taskvoidsetDestinationPoint(com.badlogic.gdx.math.Vector2 destinationPoint) Sets the destination point of entityvoidsetMovementTask(MovementTask movementTask) Sets the movement taskvoidsetStartPos(com.badlogic.gdx.math.Vector2 startPos) Sets the starting position of entityvoidstart()Start running this task.voidstop()Stop the task immediately.voidupdate()Run one frame of the task.Methods inherited from class com.deco2800.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
EnemyMovement
Creates an EnemyMovement instance.- Parameters:
terrainFactory- The terrain factory representing the game area.
-
-
Method Details
-
start
public void start()Start running this task. This will usually be called by an AI controller.- Specified by:
startin interfaceTask- Overrides:
startin classDefaultTask
-
update
public void update()Run one frame of the task. Similar to the update() in Components.- Specified by:
updatein interfaceTask- Overrides:
updatein classDefaultTask
-
getPriority
public int getPriority()Returns priority of task- Specified by:
getPriorityin interfacePriorityTask- Returns:
-
stop
public void stop()Stop the task immediately. This can be called at any time by the AI controller.- Specified by:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
getDestinationPoint
public com.badlogic.gdx.math.Vector2 getDestinationPoint()Returns the destination point of entity- Returns:
- destination point of entity
-
setDestinationPoint
public void setDestinationPoint(com.badlogic.gdx.math.Vector2 destinationPoint) Sets the destination point of entity- Parameters:
destinationPoint- Destination point of entity
-
getStartPos
public com.badlogic.gdx.math.Vector2 getStartPos()Returns the starting position upon spawning of entity- Returns:
- spawn point of entity
-
setStartPos
public void setStartPos(com.badlogic.gdx.math.Vector2 startPos) Sets the starting position of entity- Parameters:
startPos- spawn point of entity
-
selectRandomTarget
public void selectRandomTarget() -
createMovementTask
public void createMovementTask()Creates a movement task. -
setMovementTask
Sets the movement task- Parameters:
movementTask- movement task to be set
-
setCurrentTask
Sets the current task- Parameters:
currentTask- cureent task to be set
-