Ecosystem
A class in Root.Township, Alta.Populations.
Component on a location chunk listing the creature populations that live there. Server: when the chunk loads it spawns a population folder per population, or reloads the saved ones.
- Listed in World generation
- Inherits or implements
NetworkEntityBehaviour,ISpawnSystem,ISavable<EcosystemSaveData>,ISavableSave<EcosystemSaveData>,ISavableSaveBase - Derived types
EcosystemSaveData - Nested types
PopulationApplication - Attributes
RequireComponent - Documented in Populations and spawners
Constructors
| Member | What it is |
|---|---|
Ecosystem() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private float averageTimeBetweenSoundEffects | Serialized value, defaults to 10. Not read anywhere in the server build. |
private Ecosystem.PopulationApplication[] definitions | The populations this ecosystem spawns, with their size limits. |
private Dictionary<uint, Ecosystem.PopulationApplication> definitionsMap | Private: definitions by population hash, built in InitializeAsServer. |
private NetworkPrefab populationFolderPrefab | Prefab spawned to hold each population's members. |
private List<PopulationFolderBase> populations | Private: the population folders currently in this chunk. |
private Dictionary<uint, PopulationSpawnInformation> spawnInformationMap | Private: spawn points or areas per population hash, set by SetPoints and SetPopulationValue. |
private CaveLayerStreamer streamer | Private: the CaveLayerStreamer on this object, if any, used to read the generated biome. |
Properties
| Member | What it is |
|---|---|
LocationChunk Chunk { get; private set; } | The LocationChunk it is on. |
bool IsInitialized { get; private set; } | True after server initialization. |
1 private and internal property
| Member | What it is |
|---|---|
private PopulationSpawnInformation this[uint populationHash] { get; } | Indexer: the spawn information stored for a population hash, or null. |
Methods
| Member | What it is |
|---|---|
void AddPopulation(PopulationFolderBase folder) | Adds a population folder to this chunk's list. |
override void InitializeAsServer(SpawnData spawnData) | Server: maps its populations and hooks the chunk's load and unload. |
void SetPoints(List<SpawnPoint> spawnPoints, uint populationHash) | Sets the spawn points for a population, if none are set yet. |
void SetPopulationValue(uint populationHash, PopulationSpawnInformation value) | Sets the spawn information for a population, if none is set yet. |
bool TryGetPopulationValue(uint populationHash, out PopulationSpawnInformation value) | Gets a population's spawn information. |
5 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Caches the LocationChunk on the same object. |
private void ChunkInitializePopulations(Chunk chunk) | Private: when the chunk fully loads, spawns a population folder per definition if none exist, otherwise re-initializes the existing ones. |
private void CleanSpawnPoints(Chunk chunk) | Private: clears all spawn information when the chunk fully unloads. |
private void OnDrawGizmosSelected() | Empty in this build. |
private void UnloadPopulations(Chunk chunk) | Private: destroys every population when the chunk fully unloads. |
Used in
Members of other types that take, return or hold a Ecosystem: