A class in Root.Township, the global namespace.
On the player: the local client checks how dark it is around the player and asks the server to spawn darkness for them. The server spawns them through DarknessSpawnerSettings.
Constructors
| Member | What it is |
|---|
DarknessReader() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private static Logger logger | NLog logger for this class. |
private PlayerController playerCharacter | The player this reader belongs to. |
private DarknessReaderMethod readingMethod | The darkness reading method in use (compute shader based), local player only. |
private MethodSync syncRequest | Message used to send the spawn request. |
Methods
| Member | What it is |
|---|
override void Initialize() | Sets up the spawn request message and disables the component. |
5 private and internal methods
| Member | What it is |
|---|
private void IInitializeAsLocalPlayer.InitializeAsLocalPlayer(PlayerController playerController) | Local player: creates the compute shader darkness reader and turns it on or off as darkness triggers change. |
private void OnDestroy() | Unhooks from darkness triggers and turns the reader off. |
private void RequestSpawn() | Local player: sends a spawn request to the server if the reader is on. Called by the reader. |
private void SyncRequest(IPlayer player, Stream stream) | Server: on a spawn request, spawns darkness for this player. |
private void UpdateEnabled(bool isEnabled) | Turns the reader on or off. Hooked to DarknessTrigger.OnChanged. |
Used in
Members of other types that take, return or hold a DarknessReader: