Package com.csse3200.game.entities.spawn
Class SpawnRegistry
java.lang.Object
com.csse3200.game.entities.spawn.SpawnRegistry
A global registry for
EntitySpawner instances.
The SpawnRegistry maps string identifiers to spawner functions,
allowing entities to be created dynamically by ID. This is used
for loading entities from configuration files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Entitybuild(String type, LevelConfig.E a) static voidclear()Clears all registered spawners.static voidregister(String type, EntitySpawner spawner) Registers a spawner under a given type identifier.static voidunregister(String type) Removes a spawner from the registry.
-
Method Details
-
register
Registers a spawner under a given type identifier.- Parameters:
type- the types identifier stringspawner- the spawner function for creating entities
-
build
-
unregister
Removes a spawner from the registry.- Parameters:
type- the type identifier of the spawner to remove
-
clear
public static void clear()Clears all registered spawners.
-