A class in Root.Township, the global namespace.
Cluster that drives one light by how many parts it holds. The server syncs the count and clients set the light intensity from a curve.
Constructors
| Member | What it is |
|---|
LightCluster() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private PlatformLight clusterLight | The light driven by the count. |
private AnimationCurve intensityOverQuantity | Curve of light intensity against part count. |
private MethodSyncStruct<int> syncCount | Sync message for the part count. |
Methods
| Member | What it is |
|---|
override void AddingFinished(SpawnData spawnData) | After parts are added, syncs the new count and updates the light. |
override void Initialize() | Sets up the count sync message. |
override void OnConnected(Player player) | Server: sends the current count to a joining player. |
protected override void RemoveInternal(NetworkEntity part) | After a part is removed, syncs the new count and updates the light. |
2 private and internal methods
| Member | What it is |
|---|
private void SyncCount(IPlayer player, Stream stream, int count) | Sends the part count (0 to 31). Remote clients update the light. |
private void UpdateCount(int count) | Client: turns the light off at zero parts, otherwise sets its intensity from the curve. |