Class HiveTask

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

public class HiveTask extends DefaultTask implements PriorityTask
Task for a Hive entity to periodically spawn bees after a specified waiting period. Bees are spawned at random positions near the hive, and the task also handles the disposal of the bees and the hive entity when the player gets close enough. Requires an entity with a PhysicsMovementComponent.
  • Constructor Details

    • HiveTask

      public HiveTask(Entity target)
      Creates a new HiveTask for the specified target entity and initializes the waiting time for spawning bees.
      Parameters:
      target - The entity that the bees will target.
  • Method Details

    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface PriorityTask
    • start

      public void start()
      Starts the task by triggering the floating animation and initializing the list of bees.
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      Updates the task every frame. It increments elapsed time to track when to spawn a new bee. It also checks if the player is within a certain distance of the hive, and if so, it disposes of the hive and all spawned bees.
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask