FestivityManager
A class in Root.Township, the global namespace.
Network entity that turns festivities on and off by the real date and syncs their state to players. The server checks dates; clients only receive.
- Listed in Global namespace: E to H
- Inherits or implements
NetworkEntityBehaviour
Constructors
| Member | What it is |
|---|---|
FestivityManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private CancellationTokenSource cancel | Cancels the recheck loop when the manager is destroyed. |
private MethodSyncClass<Festivity> sync | Method sync (SyncA) used to send festivity state. |
private float updateIntervalSeconds | Seconds between date checks. Default 1. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Both sides: resets every festivity to inactive and sets up the sync message. |
override void InitializeAsServer(SpawnData spawnData) | Server: starts the Recheck loop. |
override void OnConnected(Player player) | Server: sends each active festivity to a joining player. |
void SetFestivityActive(Festivity festivity, bool isActive) | Sets a festivity's state and, if it changed, sends it to all chunks. Used by Check and the console commands. |
5 private and internal methods
| Member | What it is |
|---|---|
private void Check() | Server: sets each festivity active if it is enabled and the current MonthDayHour is between its start and end. |
private void OnDestroy() | Cancels the recheck loop. |
private void OnValidate() | Editor while playing on a server: restarts the check loop after inspector changes. |
private async void Recheck(CancellationToken token) | Server: async loop that runs Check every updateIntervalSeconds until cancelled. |
private void SyncFestivity(IPlayer player, Stream stream, Festivity festivity) | Sync handler: writes the festivity hash and state; remote clients apply the state on read. |