Class CurrencyTask

java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.CurrencyTask
All Implemented Interfaces:
PriorityTask, Task

public class CurrencyTask extends DefaultTask implements PriorityTask
The CurrencyTask updates the in-game currency based on time intervals.
  • 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 interface Task
      Overrides:
      start in class DefaultTask
    • 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 interface Task
      Overrides:
      update in class DefaultTask
    • updateCurrency

      public void updateCurrency()
      Updates the currency based on time intervals.
    • stop

      public void stop()
      For stopping the running task
      Specified by:
      stop in interface Task
      Overrides:
      stop in class DefaultTask
    • getPriority

      public int getPriority()
      Returns the current priority of the task.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      active priority value
    • changeInterval

      public void changeInterval(int newInterval)
    • setInterval

      public void setInterval(int interval)
    • getInterval

      public int getInterval()