ChildSyncableCollectionBase<T>
An abstract class in Root.Township, the global namespace.
Base for a component that syncs a list of child items (woodcut points, forged points) on its entity, in full or one at a time.
Constructors
| Member | What it is |
|---|
protected ChildSyncableCollectionBase() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected List<T> children | Backing list for Children. |
protected bool isForcedFullSync | True while sending a full sync to a joining player. |
protected bool isGettingChildren | Inspector button field for GetChildren. |
protected MethodSync sync | The full sync message. |
protected MethodSyncStruct<uint> syncIndividual | The message that syncs one child by index. |
Properties
| Member | What it is |
|---|
List<T> Children { get; } | The children being synced. |
protected virtual bool IsUsingSyncMessage { get; } | Whether the full sync message is used. True by default. |
Events
| Member | What it is |
|---|
event Action<bool> SyncReceived | Raised when a sync arrives, with whether it was a full sync. |
Methods
| Member | What it is |
|---|
void AddChild(T child) | Adds a child to the list. |
void GetChildren() | Editor button: adds every matching component in the object's children. Only works when the child type is a component. |
override void OnConnected(Player player) | Server: sends a joining player a forced full sync. |
virtual void SyncAllChildren() | Sends the full sync to the chunk. |
abstract void SyncChild(T child) | Implemented by subclasses to sync one child. |
protected virtual void OnSyncReceived(bool isFull) | Raises SyncReceived. |
protected virtual void OnValidate() | Editor hook. Empty in the base class. |
Used in
Members of other types that take, return or hold a ChildSyncableCollectionBase<T>: