Package com.csse3200.game.entities
Class EntitySpawner
java.lang.Object
com.csse3200.game.entities.EntitySpawner
Handles periodic spawning of one entity
-
Constructor Summary
ConstructorsConstructorDescriptionEntitySpawner
(int maxSpawnCount, UnaryOperator<Entity> spawner, int growthRate, int initialSpawnCount, int spawnHour, int randomRange, int daysBetweenSpawns) Constructor for EntitySpawner -
Method Summary
Modifier and TypeMethodDescriptionvoid
Handles each hour trigger - responsible for calling spawnNPC() at correct timevoid
setGameArea
(GameArea gameArea) Set GameAreavoid
Spawns entities onto the GameAreavoid
Begin periodic spawning
-
Constructor Details
-
EntitySpawner
public EntitySpawner(int maxSpawnCount, UnaryOperator<Entity> spawner, int growthRate, int initialSpawnCount, int spawnHour, int randomRange, int daysBetweenSpawns) Constructor for EntitySpawner- Parameters:
maxSpawnCount
- maximum number of entities that can be spawned in one cyclespawner
- method that creates the entitygrowthRate
- linear growth rate of number of entities spawned each spawn cycleinitialSpawnCount
- the initial number of entities to be spawnedspawnHour
- the hour that the entities will be spawned or the hour after which a randomGoal will be determined.randomRange
- max number of hours that the entity may spawn after spawnHourdaysBetweenSpawns
- minimum number of times spawnHour must occur between spawns
-
-
Method Details
-
setGameArea
Set GameArea- Parameters:
gameArea
- GameArea to spawn entities
-
startSpawner
public void startSpawner()Begin periodic spawning -
hourUpdate
public void hourUpdate()Handles each hour trigger - responsible for calling spawnNPC() at correct time -
spawnEntities
public void spawnEntities()Spawns entities onto the GameArea
-