StaticGenerationParent
A class in Root.Township, the global namespace.
Networked root for static generation: picks a seed on the server, saves it, sends it to joining players, and each side regenerates the same static children from that seed.
- Listed in Global namespace: S
- Inherits or implements
MonoBehaviour,IStaticGeneration,INetworkEntityBehaviour,ISavable<StaticGenerationParentSaveData>,ISavableSave<StaticGenerationParentSaveData>,ISavableSaveBase - Derived types
StaticGenerationParentSaveData
Constructors
| Member | What it is |
|---|---|
StaticGenerationParent() | Creates a StaticGenerationParent with default values. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private bool btnTest | Inspector button that calls Test. |
private bool btnTestRest | Inspector button that calls TestReset. |
private NetworkEntity entity | Backing field for Entity. |
private bool isGenerated | True once the targets have been generated, so a second Generate call does nothing. |
private static Logger logger | NLog logger; reports null entries in targets. |
private int seed | Random seed for generation. -1 until the server picks one or loads it from the save. |
private MethodSync sync | Method sync that sends the seed to clients. |
private List<GameObject> targets | Child objects whose static generation this parent runs. |
Properties
| Member | What it is |
|---|---|
NetworkEntity Entity { get; } | The NetworkEntity on this object, cached on Initialize. |
Methods
10 private and internal methods
| Member | What it is |
|---|---|
private void Generate(SpawnData data) | The private overload runs static generation on this object with the saved seed. The interface one generates each of targets with its own random seed, once until Reset. |
private void IStaticGeneration.Generate(NetworkEntity dynamicParent, SpawnData spawnData) | The private overload runs static generation on this object with the saved seed. The interface one generates each of targets with its own random seed, once until Reset. |
private void Alta.Networking.INetworkEntityBehaviour.Initialize() | Caches the entity and sets up the StaticSeed method sync. |
private void Alta.Networking.INetworkEntityBehaviour.InitializeAsServer(SpawnData data) | Server: picks a random seed if none was loaded, then generates. |
private void Alta.Networking.INetworkEntityBehaviour.OnConnected(Player player) | Server: sends the seed to the joining player. |
private void Alta.Networking.INetworkEntityBehaviour.OnDisconnected(Player player) | Does nothing. |
private void IStaticGeneration.Reset() | Clears isGenerated and resets every target. |
private void Sync(IPlayer player, Stream stream) | Reads or writes the seed; a client that receives it generates the static content. |
private void Test() | Editor button: resets and regenerates with the current seed, or a random one if none is set. |
private void TestReset() | Editor button: resets all static generation on this object. |