Example #1
0
        /// <summary>
        /// Called by the replay system when all replay state information should be deserialized.
        /// </summary>
        /// <param name="state">The <see cref="ReplayState"/> to read the data from</param>
        public void OnReplayDeserialize(ReplayState state)
        {
            // Read the id
            eventID = state.ReadByte();

            // Read the size
            byte size = state.ReadByte();

            // Read the data
            eventData = state.ReadState(size);
        }
Example #2
0
        /// <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);
            }
        }