public void OnReplayDeserialize(ReplayState state) { int size = state.Read32(); for (int i = 0; i < size; i++) { // Read the target identity ReplayIdentity identity = state.ReadIdentity(); int localSize = state.Read32(); // Read all states for (int j = 0; j < localSize; j++) { // Create empty data container ReplayInitialData data = new ReplayInitialData(); // Deserialize data data.OnReplayDeserialize(state); // Register state if (initialStates.ContainsKey(identity) == false) { initialStates.Add(identity, new List <ReplayInitialData>()); } initialStates[identity].Add(data); } } }
/// <summary> /// Called by the replay system when this <see cref="ReplaySnapshot"/> should be deserialized. /// </summary> /// <param name="state">The <see cref="ReplayState"/> to read the data from</param> public void OnReplayDeserialize(ReplayState state) { timeStamp = state.ReadFloat(); // Read states size int size = state.Read32(); // Read all states for (int i = 0; i < size; i++) { // Read the identity ReplayIdentity identity = state.ReadIdentity(); // Read size short stateSize = state.Read16(); // Read the state data ReplayState stateData = state.ReadState(stateSize); // Add to states states.Add(identity, stateData); } }