Package com.deco2800.game.ai.tasks
Class DefaultTask
java.lang.Object
com.deco2800.game.ai.tasks.DefaultTask
- All Implemented Interfaces:
Task
- Direct Known Subclasses:
ChaseTask
,MovementTask
,ObstacleAttackTask
,WaitTask
,WanderTask
public abstract class DefaultTask extends java.lang.Object implements Task
A default task implementation that stores the associated entity and updates status when
starting/stopping a task. Removes some boilerplate code from each task.
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected TaskRunner
owner
protected Task.Status
status
-
Constructor Summary
Constructors Constructor Description DefaultTask()
-
Method Summary
Modifier and Type Method Description void
create(TaskRunner taskRunner)
Create the task and attach it to the task runner.Task.Status
getStatus()
Get the current status of the task.void
start()
Start running this task.void
stop()
Stop the task immediately.void
update()
Run one frame of the task.
-
Field Details
-
Constructor Details
-
DefaultTask
public DefaultTask()
-
-
Method Details
-
create
Description copied from interface:Task
Create the task and attach it to the task runner. -
start
public void start()Description copied from interface:Task
Start running this task. This will usually be called by an AI controller. -
update
public void update()Description copied from interface:Task
Run one frame of the task. Similar to the update() in Components. -
stop
public void stop()Description copied from interface:Task
Stop the task immediately. This can be called at any time by the AI controller. -
getStatus
Description copied from interface:Task
Get the current status of the task.
-