PlayerCommunicationManager
A class in Root.Township, the global namespace.
Networked singleton the server uses to show a text message on players' screens. Get it from Instance.
Constructors
| Member | What it is |
|---|
PlayerCommunicationManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
Properties
Methods
| Member | What it is |
|---|
override void Initialize() | Sets up the network message used to send text to players. |
void SendMessageToAllPlayers(string message, float displayDuration = 5) | Server: sends the message to every connected player, shown for the given seconds (5 by default). |
void SendMessageToPlayer(IPlayer player, string message, float displayDuration = 5) | Server: sends the message to one player with a player controller. Logs an error if called on a client. |
2 private and internal methods
| Member | What it is |
|---|
private void Awake() | Sets instance. |
private void HandlePlayerMessage(IPlayer player, Stream stream, PlayerTextMessage textMessage) | Serializes the message; on the receiving client, shows it on the local player's message display. |