Class EntitySpawner<T extends IEntity>
java.lang.Object
de.gurkenlabs.litiengine.environment.EntitySpawner<T>
- All Implemented Interfaces:
IEntitySpawner<T>,IUpdateable
TODO: Implement spawn event/listener TODO: Implement additional constructors to enhance the API
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.gurkenlabs.litiengine.environment.IEntitySpawner
IEntitySpawner.SpawnMode -
Constructor Summary
ConstructorsConstructorDescriptionEntitySpawner(int interval, int amount) EntitySpawner(int interval, int amount, Function<IEntitySpawner<T>, List<Spawnpoint>> spawnpointCallback) EntitySpawner(int amount, Function<IEntitySpawner<T>, List<Spawnpoint>> spawnpointCallback) EntitySpawner(List<Spawnpoint> spawnpoints, int interval, int amount) EntitySpawner(List<Spawnpoint> spawnpoints, int interval, int amount, IEntitySpawner.SpawnMode spawnMode) Initializes a new instance of theEntitySpawnerclass.EntitySpawner(List<Spawnpoint> spawnpoints, int amount, IEntitySpawner.SpawnMode spawnMode) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<Spawnpoint> intGets the amount of Entities that are spawned in each wave.intGets the delay between spawning individual Entities of one wave.intGets the interval between spawn waves.Gets the spawn mode for an EntitySpawner.Gets the list of SpawnPoints that a EntitySpawner uses.voidsetSpawnAmount(int amount) Sets the amount of Entities that spawn in each wave.voidsetSpawnDelay(int delay) Gets the delay in milliseconds between spawning individual Entities of one wave.voidsetSpawnInterval(int interval) Sets the interval in milliseconds between each spawn wave.voidSets the spawn mode.protected booleanprotected voidSpawn new entities, depending on theSpawnMode, spawnAmount, spawnDelay, and spawnInterval of anEntitySpawner.voidupdate()This method is called by the game loop on all objects that are attached to the loop.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.gurkenlabs.litiengine.environment.IEntitySpawner
createNew
-
Constructor Details
-
EntitySpawner
public EntitySpawner(int interval, int amount) -
EntitySpawner
-
EntitySpawner
-
EntitySpawner
public EntitySpawner(List<Spawnpoint> spawnpoints, int interval, int amount, IEntitySpawner.SpawnMode spawnMode) Initializes a new instance of theEntitySpawnerclass.- Parameters:
spawnpoints- The spawnpoints from which this instance will choose from when spawning entities.interval- The interval in which entities will be spawned.amount- The amount of entities to spawn on every spawn event.spawnMode- the spawning behaviour
-
EntitySpawner
-
EntitySpawner
public EntitySpawner(int interval, int amount, Function<IEntitySpawner<T>, List<Spawnpoint>> spawnpointCallback)
-
-
Method Details
-
getSpawnAmount
public int getSpawnAmount()Description copied from interface:IEntitySpawnerGets the amount of Entities that are spawned in each wave.- Specified by:
getSpawnAmountin interfaceIEntitySpawner<T extends IEntity>- Returns:
- the spawn amount
-
getSpawnInterval
public int getSpawnInterval()Description copied from interface:IEntitySpawnerGets the interval between spawn waves.- Specified by:
getSpawnIntervalin interfaceIEntitySpawner<T extends IEntity>- Returns:
- the spawn interval
-
getSpawnDelay
public int getSpawnDelay()Description copied from interface:IEntitySpawnerGets the delay between spawning individual Entities of one wave.- Specified by:
getSpawnDelayin interfaceIEntitySpawner<T extends IEntity>- Returns:
- the spawn delay
-
getSpawnMode
Description copied from interface:IEntitySpawnerGets the spawn mode for an EntitySpawner.- Specified by:
getSpawnModein interfaceIEntitySpawner<T extends IEntity>- Returns:
- the spawn mode
- See Also:
-
getSpawnPoints
Description copied from interface:IEntitySpawnerGets the list of SpawnPoints that a EntitySpawner uses.- Specified by:
getSpawnPointsin interfaceIEntitySpawner<T extends IEntity>- Returns:
- the spawn points
-
setSpawnAmount
public void setSpawnAmount(int amount) Description copied from interface:IEntitySpawnerSets the amount of Entities that spawn in each wave.- Specified by:
setSpawnAmountin interfaceIEntitySpawner<T extends IEntity>- Parameters:
amount- the new amount
-
setSpawnInterval
public void setSpawnInterval(int interval) Description copied from interface:IEntitySpawnerSets the interval in milliseconds between each spawn wave.- Specified by:
setSpawnIntervalin interfaceIEntitySpawner<T extends IEntity>- Parameters:
interval- the new interval
-
setSpawnDelay
public void setSpawnDelay(int delay) Description copied from interface:IEntitySpawnerGets the delay in milliseconds between spawning individual Entities of one wave.- Specified by:
setSpawnDelayin interfaceIEntitySpawner<T extends IEntity>- Parameters:
delay- the new spawn delay
-
setSpawnMode
Description copied from interface:IEntitySpawnerSets the spawn mode.- Specified by:
setSpawnModein interfaceIEntitySpawner<T extends IEntity>- Parameters:
mode- the new spawn mode- See Also:
-
update
public void update()Description copied from interface:IUpdateableThis method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using theClientConfiguration.- Specified by:
updatein interfaceIUpdateable- See Also:
-
shouldSpawn
protected boolean shouldSpawn() -
getCustomSpawnpoints
-
spawnNewEntities
protected void spawnNewEntities()Spawn new entities, depending on theSpawnMode, spawnAmount, spawnDelay, and spawnInterval of anEntitySpawner.- See Also:
-