Class SyncVar<T>
- Namespace
- AO
- Assembly
- CoreAssembly.dll
SyncVar allows you to keep variables in sync from the server to all clients.
public class SyncVar<T> : SyncVarBase
Type Parameters
TSupported types: int, float, bool, string, Vector2, Vector3, Vector4, Entity
- Inheritance
-
SyncVar<T>
- Inherited Members
- Extension Methods
Constructors
SyncVar()
public SyncVar()
SyncVar(T)
public SyncVar(T value)
Parameters
valueT
Properties
Value
public T Value { get; }
Property Value
- T
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
OnSyncGeneric_Internal(T)
public void OnSyncGeneric_Internal(T newValue)
Parameters
newValueT
OnSync_Internal(StreamReader)
public override void OnSync_Internal(StreamReader reader)
Parameters
readerStreamReader
OnSync_Internal(byte[])
public override void OnSync_Internal(byte[] data)
Parameters
databyte[]
Set(T)
public void Set(T value)
Parameters
valueT
Set(T, bool)
Set the value of the SyncVar. This should only be called on the server.
public void Set(T value, bool forceSync = false)
Parameters
valueTValue to set the SyncVar to
forceSyncbool
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
WriteToStreamWriter(StreamWriter)
public override void WriteToStreamWriter(StreamWriter writer)
Parameters
writerStreamWriter
Events
OnSync
public event Action<T, T> OnSync
Event Type
- Action<T, T>
Operators
operator ==(SyncVar<T>, SyncVar<T>)
public static bool operator ==(SyncVar<T> a, SyncVar<T> b)
Parameters
Returns
operator ==(SyncVar<T>, T)
public static bool operator ==(SyncVar<T> a, T b)
Parameters
aSyncVar<T>bT
Returns
operator ==(T, SyncVar<T>)
public static bool operator ==(T a, SyncVar<T> b)
Parameters
aTbSyncVar<T>
Returns
implicit operator T(SyncVar<T>)
public static implicit operator T(SyncVar<T> syncVar)
Parameters
syncVarSyncVar<T>
Returns
- T
operator !=(SyncVar<T>, SyncVar<T>)
public static bool operator !=(SyncVar<T> a, SyncVar<T> b)
Parameters
Returns
operator !=(SyncVar<T>, T)
public static bool operator !=(SyncVar<T> a, T b)
Parameters
aSyncVar<T>bT
Returns
operator !=(T, SyncVar<T>)
public static bool operator !=(T a, SyncVar<T> b)
Parameters
aTbSyncVar<T>