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 TypeMethodDescriptionvoid
Creates a movement task.com.badlogic.gdx.math.Vector2
Returns the destination point of entityint
Returns priority of taskcom.badlogic.gdx.math.Vector2
Returns the starting position upon spawning of entityvoid
void
setCurrentTask
(Task currentTask) Sets the current taskvoid
setDestinationPoint
(com.badlogic.gdx.math.Vector2 destinationPoint) Sets the destination point of entityvoid
setMovementTask
(MovementTask movementTask) Sets the movement taskvoid
setStartPos
(com.badlogic.gdx.math.Vector2 startPos) Sets the starting position of entityvoid
start()
Start running this task.void
stop()
Stop the task immediately.void
update()
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:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Run one frame of the task. Similar to the update() in Components.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
getPriority
public int getPriority()Returns priority of task- Specified by:
getPriority
in interfacePriorityTask
- Returns:
-
stop
public void stop()Stop the task immediately. This can be called at any time by the AI controller.- Specified by:
stop
in interfaceTask
- Overrides:
stop
in 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
-