Class CurrencyTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.CurrencyTask
- All Implemented Interfaces:
PriorityTask
,Task
The CurrencyTask updates the in-game currency based on time intervals.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.csse3200.game.ai.tasks.Task
Task.Status
-
Field Summary
Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
changeInterval
(int newInterval) int
int
Returns the current priority of the task.void
setInterval
(int interval) void
start()
Starts the Task running and initializes currency-related variables.void
stop()
For stopping the running taskvoid
update()
The update method is what is run every time the TaskRunner in the AiTaskComponent calls update().void
Updates the currency based on time intervals.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
CurrencyTask
public CurrencyTask(int priority, int interval) - Parameters:
priority
- Task priority for currency updates. Must be a positive integer.
-
-
Method Details
-
start
public void start()Starts the Task running and initializes currency-related variables.- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()The update method is what is run every time the TaskRunner in the AiTaskComponent calls update(). Updates the currency based on time intervals.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
updateCurrency
public void updateCurrency()Updates the currency based on time intervals. -
stop
public void stop()For stopping the running task- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()Returns the current priority of the task.- Specified by:
getPriority
in interfacePriorityTask
- Returns:
- active priority value
-
changeInterval
public void changeInterval(int newInterval) -
setInterval
public void setInterval(int interval) -
getInterval
public int getInterval()
-