Skip to main content

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.

Constructors​

MemberWhat 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
MemberWhat it is
private SerializeMethod defaultHandlerHandler passed to the constructor.
private INetworkEntity entityThe entity this sync belongs to.
private EntityMessageType typeThe entity message type this sync uses.

Properties​

MemberWhat it is
virtual SerializeMethod Handler { get; }The method that writes or reads this sync's data.

Methods​

MemberWhat 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.