public abstract class Synchronizable : CommunicationBridgeUID
public class ExampleSynchronizable : Synchronizable
{
// Data to be synchronized with other players in our playroom.
public float SynchronizedFloat = 3.0f;
// Used to store the previous version of our data so that we know when it has changed.
private float _oldSynchronizedFloat;
public override void DisassembleData(Reader reader, byte LOD)
{
// Set our data to the updated value we have recieved from another player.
SynchronizedFloat = reader.ReadFloat();
// Save the new data as our old data, otherwise we will immediatly think it changed again.
_oldSynchronizedFloat = SynchronizedFloat;
}
public override void AssembleData(Writer writer, byte LOD)
{
// Write our data so that it can be sent to the other players in our playroom.
writer.Write(SynchronizedFloat);
}
private void Update()
{
// If the value of our float has changed, sync it with the other players in our playroom.
if (SynchronizedFloat != _oldSynchronizedFloat)
{
// Store the updated value
_oldSynchronizedFloat = SynchronizedFloat;
// Tell Alteruna Multiplayer that we want to commit our data.
Commit();
}
// Update the Synchronizable
base.SyncUpdate();
}
}
AssembleData | Called by the SynchronizableManager after Commit() to collect the data to be synced before sending it. |
BroadcastRemoteMethod(Int32, Object) | Commits method with the SynchronizableMethod attribute on evey client including sender with given parameters. |
BroadcastRemoteMethod(String, Object) | Commits method with the SynchronizableMethod attribute on evey client including sender with given parameters. with given parameters. |
Commit | This method informs the SynchronizableManager that this synchronizable has new data that needs to be synced. |
DisassembleData | Called by the SynchronizableManager after recieving new data to be synced with this Synchronizable. |
GetMethodAttributeId | Get id of method with the SynchronizableMethod attribute by name. |
GetMethodAttributeName | Get name of method with the SynchronizableMethod attribute by index. |
InvokeRemoteMethod(Int32, Object) | Commits method with the SynchronizableMethod attribute on evey client excluding sender with given parameters. |
InvokeRemoteMethod(String, Object) | Commits method with the SynchronizableMethod attribute on evey client excluding sender with given parameters. with given parameters. |
Register | (Overrides CommunicationBridgeUIDRegister) |
Reset | (Overrides CommunicationBridgeUIDReset) |
Serialize |
Serialize Synchronizable.
(Overrides CommunicationBridgeUIDSerialize(ITransportStreamWriter, Byte, Boolean)) |
SyncUpdate | Update the internals of the Synchronizable. |
Unserialize |
Unserialize Synchronizable.
(Overrides CommunicationBridgeUIDUnserialize(ITransportStreamReader, Byte, UInt32)) |
BucketBehaviors | A list of Bucket Behaviors describing how this Synchronizable is syncrhonized depending on which Bucket it is being sent to. |
MAX_LOD | The highest NetLOD value a Synchronizable can have. |
Reliability | Reliability of the Synchronizable. |