public override void OnDeserialize(NetworkReader reader, bool initialState) { if (synchDirection == SyncDirection.ServerToClient) { CurrentStatus = Status.IsReading; //if (debug) Debug.Log ("OnSerialize initialState:" + initialState, this); bool missingData = false; if (observed != null) { PlayMakerUnetUtils.ReadStreamToFsmVars(this, observed.Fsm, NetworkSynchVariableLOT, reader, out missingData, false); } } }
} // SetUpFsmVariableToSynch public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (synchDirection == SyncDirection.ServerToClient) { CurrentStatus = Status.IsWriting; //if (debug) Debug.Log ("OnSerialize forceAll:" + forceAll, this); if (observed != null) { PlayMakerUnetUtils.WriteStreamFromFsmVars(this, writer, observed.Fsm, NetworkSynchVariableLOT, false); } return(true); } return(false); }
public void Cmd_SerializeData(byte[] data) { if (isServer) { if (debug) { Debug.Log(this.name + ": Cmd_SerializeData-> ", this); } CurrentStatus = Status.IsReading; //if (debug) Debug.Log ("OnSerialize initialState:" + initialState, this); bool missingData = false; if (observed != null) { PlayMakerUnetUtils.ReadStreamToFsmVars(this, observed.Fsm, NetworkSynchVariableLOT, new NetworkReader(data), out missingData, true); } } }
void Update() { CheckForDirtyFsmVariables(); if (!isServer && hasAuthority && observed != null && synchDirection == SyncDirection.ClientToServer) { CurrentStatus = Status.IsWriting; if (Time.realtimeSinceStartup - _lastClientToServerSynch > m_SendInterval) { _lastClientToServerSynch = Time.realtimeSinceStartup; Debug.Log("Synching from Client to Server"); _nw = new NetworkWriter(); PlayMakerUnetUtils.WriteStreamFromFsmVars(this, _nw, observed.Fsm, NetworkSynchVariableLOT, true); this.Cmd_SerializeData(_nw.ToArray()); } } else if (isServer && hasAuthority) { } }