Skip to main content

Sync<T>

An abstract class in Root.Township, Alta.Networking.

Base for an entity sync that sends a value of type T. Registers its handler with the entity's message handler for one message type.

Constructors​

MemberWhat it is
Sync(NetworkEntity entity, EntityMessageType type)Creates a Sync from entity and type.

Fields​

2 private and internal fields
MemberWhat it is
private NetworkEntity entityThe entity this sync belongs to.
private EntityMessageType typeThe entity message type this sync uses.

Properties​

MemberWhat it is
abstract SerializeMethod Handler { get; }The method that writes or reads the value; set by the subclass.
T Value { get; protected set; }The value last sent.

Methods​

MemberWhat it is
void SendToChunks(T value, params IPlayer[] except)Stores the value and sends it to everyone in the entity's chunks, except the given players.
void SendToPlayer(IPlayer player, T value)Stores the value and sends it to one player.