Skip to main content

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.

Constructors​

MemberWhat it is
Ecosystem()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private float averageTimeBetweenSoundEffectsSerialized value, defaults to 10. Not read anywhere in the server build.
private Ecosystem.PopulationApplication[] definitionsThe populations this ecosystem spawns, with their size limits.
private Dictionary<uint, Ecosystem.PopulationApplication> definitionsMapPrivate: definitions by population hash, built in InitializeAsServer.
private NetworkPrefab populationFolderPrefabPrefab spawned to hold each population's members.
private List<PopulationFolderBase> populationsPrivate: the population folders currently in this chunk.
private Dictionary<uint, PopulationSpawnInformation> spawnInformationMapPrivate: spawn points or areas per population hash, set by SetPoints and SetPopulationValue.
private CaveLayerStreamer streamerPrivate: the CaveLayerStreamer on this object, if any, used to read the generated biome.

Properties​

MemberWhat 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
MemberWhat it is
private PopulationSpawnInformation this[uint populationHash] { get; }Indexer: the spawn information stored for a population hash, or null.

Methods​

MemberWhat 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
MemberWhat 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: