Spawner. More...
Classes | |
class | PositionInfo |
class | PrefabInfo |
Public Member Functions | |
virtual void | OnMessage (MessageArgs messageArgs) |
Handles a message that the message handler is listening for. | |
virtual void | StartSpawning () |
Starts spawning. | |
virtual void | StopSpawning () |
Stops spawning. | |
virtual void | DespawnAll () |
Stops spawning and despawns all spawned entities. | |
virtual void | AddRestoredEntity (SpawnedEntity spawnedEntity) |
Static Public Member Functions | |
static Spawner | FindSpawner (string spawnerName) |
Protected Member Functions | |
virtual void | Awake () |
virtual void | Start () |
virtual IEnumerator | StartSpawningAfterSaveDataApplied () |
virtual void | OnDestroy () |
virtual void | RegisterWithMessageSystem () |
virtual void | UnregisterWithMessageSystem () |
virtual IEnumerator | SpawnCoroutine () |
This coroutine runs until killed, spawning entities so the count remains between min and max. | |
virtual void | SetupSpawnpoints () |
Prepares for spawning. | |
virtual void | SpawnAndPlaceEntity () |
Spawns an entity and places it in the scene. | |
virtual bool | IsThereSpaceForEntity () |
Checks if there is space (e.g., an available spawnpoint) for the entity. | |
virtual void | PlaceSpawnedEntity (SpawnedEntity spawnedEntity) |
Places a spawned entity in the scene. | |
void | PlaceSpawnedEntityInRadius (SpawnedEntity spawnedEntity) |
Places an entity within the specified radius of the spawner. | |
virtual void | PlaceSpawnedEntityInSpawnpoint (SpawnedEntity spawnedEntity) |
Places an entity at an available spawnpoint. | |
virtual void | RemoveSpawnedEntity (SpawnedEntity spawnedEntity) |
Removes an entity from the spawnedEntities list. | |
virtual SpawnedEntity | SpawnEntity () |
Spawns an entity and returns the SpawnedEntity component on it, adding the component if necessary. | |
virtual PrefabInfo | ChooseWeightedRandomPrefab () |
virtual void | DespawnEntity (SpawnedEntity spawnedEntity) |
Despawns an entity. | |
virtual GameObject | InstantiateEntity (GameObject prefab) |
Returns an instance of a prefab. | |
virtual void | DestroyEntity (GameObject go) |
Destroys an instance of a prefab. | |
virtual void | OnSpawnedEntityDisabled (SpawnedEntity spawnedEntity) |
Invoked by a SpawnedEntity when it's disabled. | |
Protected Attributes | |
List< int > | m_availablePositions = new List<int>() |
Static Protected Attributes | |
static List< Spawner > | m_spawners = new List<Spawner>() |
Properties | |
StringField | spawnerName [get, set] |
Name by which Quest Machine can reference this spawner. | |
PrefabInfo[] | prefabs [get, set] |
Prefabs to spawn. | |
PositionInfo | positionInfo [get, set] |
Where to spawn. | |
List< SpawnedEntity > | spawnedEntities [get, set] |
Entities that have been spawned. | |
bool | spawnAsRootObjects [get, set] |
Make spawned entities root objects instead of children of spawner. | |
int | min [get, set] |
Minimum number of entities to spawn. | |
int | max [get, set] |
Maximum number of entities to spawn. | |
float | spawnRate [get, set] |
Once above the minimum, spawn one entity at this frequency in seconds. | |
bool | autoStart [get, set] |
Start spawning as soon as this component starts. | |
bool | autoStartAfterSaveDataApplied [get, set] |
If Auto Start is ticked, wait for save data to be applied if loading a saved game or changing scenes. | |
bool | stopWhenMinReached [get, set] |
Stop spawning as soon as the minimum number of entities has been reached. | |
bool | despawnOnDestroy [get, set] |
Despawn all spawned entities when this component is destroyed. | |
int | spawnCount [get, set] |
Spawner.
Methods are virtual so you can override them if you need custom behavior.
|
inlinevirtual |
|
inlineprotectedvirtual |
Reimplemented in PixelCrushers.QuestMachine.ServerSpawner.
|
inlineprotectedvirtual |
|
inlinevirtual |
Stops spawning and despawns all spawned entities.
Reimplemented in PixelCrushers.QuestMachine.ServerSpawner.
|
inlineprotectedvirtual |
Despawns an entity.
spawnedEntity |
|
inlineprotectedvirtual |
Destroys an instance of a prefab.
Override this method if you want to use a pooling system to return the instance to the pool.
|
inlinestatic |
|
inlineprotectedvirtual |
Returns an instance of a prefab.
Override this method if you want to use a pooling system instead of Instantiate.
Reimplemented in PixelCrushers.QuestMachine.ServerSpawner.
|
inlineprotectedvirtual |
Checks if there is space (e.g., an available spawnpoint) for the entity.
|
inlineprotectedvirtual |
|
inlinevirtual |
Handles a message that the message handler is listening for.
messageArgs | The message that was sent to the MessageSystem. |
Implements PixelCrushers.IMessageHandler.
|
inlineprotectedvirtual |
Invoked by a SpawnedEntity when it's disabled.
Removes it from the spawnedEntities list.
spawnedEntity |
|
inlineprotectedvirtual |
Places a spawned entity in the scene.
|
inlineprotected |
Places an entity within the specified radius of the spawner.
|
inlineprotectedvirtual |
Places an entity at an available spawnpoint.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
Removes an entity from the spawnedEntities list.
spawnedEntity |
|
inlineprotectedvirtual |
Prepares for spawning.
|
inlineprotectedvirtual |
Spawns an entity and places it in the scene.
Reimplemented in PixelCrushers.QuestMachine.EmeraldAISupport.EmeraldSpawner.
|
inlineprotectedvirtual |
This coroutine runs until killed, spawning entities so the count remains between min and max.
|
inlineprotectedvirtual |
Spawns an entity and returns the SpawnedEntity component on it, adding the component if necessary.
|
inlineprotectedvirtual |
|
inlinevirtual |
Starts spawning.
May stop automatically if stopWhenMinReached is true.
Reimplemented in PixelCrushers.QuestMachine.ServerSpawner.
|
inlineprotectedvirtual |
|
inlinevirtual |
Stops spawning.
Reimplemented in PixelCrushers.QuestMachine.ServerSpawner.
|
inlineprotectedvirtual |
|
protected |
|
getset |
Start spawning as soon as this component starts.
|
getset |
If Auto Start is ticked, wait for save data to be applied if loading a saved game or changing scenes.
|
getset |
Despawn all spawned entities when this component is destroyed.
|
getset |
Maximum number of entities to spawn.
|
getset |
Minimum number of entities to spawn.
|
getset |
Where to spawn.
|
getset |
Prefabs to spawn.
|
getset |
Make spawned entities root objects instead of children of spawner.
|
getsetprotected |
|
getset |
Entities that have been spawned.
|
getset |
Name by which Quest Machine can reference this spawner.
|
getset |
Once above the minimum, spawn one entity at this frequency in seconds.
|
getset |
Stop spawning as soon as the minimum number of entities has been reached.