A class in Root.Township, Alta.Populations.
Base for a networked object that owns a population (a group of spawned creatures or objects), and raises inspector events when it starts, dies out or is full.
Constructors
| Member | What it is |
|---|
PopulationFolderBase() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected Dictionary<int, PopulationFolderBase.SerializedChild> serializedentitiesSpawnPoint | Loaded child entities by spawn point, kept until Initialize adds them to the population. |
3 private and internal fields
| Member | What it is |
|---|
private PopulationEvent OnPopulationDiedOut | Unity event raised when the population sample dies out. |
private PopulationEvent OnPopulationMaxed | Unity event raised when the population sample reaches its maximum. |
private PopulationEvent OnPopulationStarted | Unity event raised when the population starts, and straight away in SetSample if it already has members. |
Properties
| Member | What it is |
|---|
uint Hash { get; } | The population definition's hash. |
PopulationSample Population { get; protected set; } | The population sample: what's spawned and how many. |
virtual PopulationDefinition PopulationDefinition { get; protected set; } | What this population spawns. Taken from Population unless a subclass overrides it. |
protected virtual bool AddToEcosystem { get; } | Whether the population joins the chunk's Ecosystem when the entity is added to a procedural chunk. True by default. |
Methods
| Member | What it is |
|---|
void Initialize(LocationChunk chunk, ISpawnSystem spawner) | Server: initializes the population for a chunk and spawner, and adds back any loaded children at their spawn points. |
override void InitializeAsServer(SpawnData spawnData) | Server: hooks up joining the ecosystem when the entity is added to a chunk. |
void SetSample(PopulationSample sample) | Sets the population sample once and hooks its events to the inspector events. A second sample is destroyed with an error. |
1 private and internal method
| Member | What it is |
|---|
private void TryAddToEcosystem(Chunk chunk) | Server: when added to a procedural chunk, registers this population with the chunk's Ecosystem. |
Used in
Members of other types that take, return or hold a PopulationFolderBase: