DayNightOnlyTimerDefinition
A class in Root.Township, Alta.Populations.
Population timer asset that checks its populations only when night starts (or day, if spawnOnlyDuringNight is off). Spawned elements decay after one night or day.
Constructors
| Member | What it is |
|---|
DayNightOnlyTimerDefinition() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
2 private and internal fields
| Member | What it is |
|---|
private HashSet<GlobalPopulationDefinition> activePopulations | Populations using this timer. |
private bool spawnOnlyDuringNight | True spawns at night, false spawns during the day. |
Properties
| Member | What it is |
|---|
override float ElementDecayTime { get; } | The night duration, or the day duration when spawning during the day. |
override bool SpawnOnInitialize { get; } | Always false: these populations wait for the right time of day. |
Methods
1 private and internal method
| Member | What it is |
|---|
private void CheckSpawnedInternal(bool isNight) | On a day or night change, runs CheckSpawned on every active population if the new time matches. |