Class HiveTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.HiveTask
- All Implemented Interfaces:
PriorityTask
,Task
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.
-
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
Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus, setOwner, stop
-
Constructor Details
-
HiveTask
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 interfacePriorityTask
-
start
public void start()Starts the task by triggering the floating animation and initializing the list of bees.- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
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 interfaceTask
- Overrides:
update
in classDefaultTask
-