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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeInterval(int newInterval) intintReturns the current priority of the task.voidsetInterval(int interval) voidstart()Starts the Task running and initializes currency-related variables.voidstop()For stopping the running taskvoidupdate()The update method is what is run every time the TaskRunner in the AiTaskComponent calls update().voidUpdates 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:
startin interfaceTask- Overrides:
startin 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:
updatein interfaceTask- Overrides:
updatein classDefaultTask
-
updateCurrency
public void updateCurrency()Updates the currency based on time intervals. -
stop
public void stop()For stopping the running task- Specified by:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
getPriority
public int getPriority()Returns the current priority of the task.- Specified by:
getPriorityin interfacePriorityTask- Returns:
- active priority value
-
changeInterval
public void changeInterval(int newInterval) -
setInterval
public void setInterval(int interval) -
getInterval
public int getInterval()
-