Sync
An abstract class in Root.Township, Alta.Networking.
Base for an entity sync with one handler method that both writes and reads. Registers the handler with the entity's message handler for one message type.
- Listed in Networking and servers
- Derived types
MethodSync,ClassSerializer<T>
Constructors
| Member | What it is |
|---|---|
Sync(INetworkEntity entity, EntityMessageType type, StreamMethod handler) | Creates a Sync from entity, type and handler. |
Sync(INetworkEntity entity, EntityMessageType type, SerializeMethod handler = null) | Creates a Sync from entity, type and handler. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private SerializeMethod defaultHandler | Handler passed to the constructor. |
private INetworkEntity entity | The entity this sync belongs to. |
private EntityMessageType type | The entity message type this sync uses. |
Properties
| Member | What it is |
|---|---|
virtual SerializeMethod Handler { get; } | The method that writes or reads this sync's data. |
Methods
| Member | What it is |
|---|---|
void SendToChunks(params IPlayer[] except) | Sends the data to everyone in the entity's chunks, except the given players. |
void SendToPlayer(IPlayer player) | Sends the data to one player. |