private void WriteReplayDataToMemory() { RecordingTime += Time.deltaTime; if (RecordingTime >= ReplayRate * _tick) { if (!_replayWriter.GetStream().CanWrite) { return; } // Add Streamposition of start of the frame to the keyFrameLists _replayStartPositionsInStream.Add((int)_replayWriter.GetStream().Position, 0); var snapshotAtFrame = _snapshotAtFrame; var deltaFrames = ((_tick - 1) % snapshotAtFrame); if (deltaFrames > 0) { _replayDeltaRecorder.WriteFrame(RecordingTime, _tick - 1, (int)deltaFrames); } else if (deltaFrames == 0) { _replaySnapshotRecorder.WriteFrame(RecordingTime, _tick - 1, (int)deltaFrames); } _tick++; OnRecordFrameChanged?.Invoke(); } SizeOfStream = _replayWriter.GetStream().Length; }
public void RecordAllReplayObservable(IReplayWriter writer, ReplayInfo info) { foreach (var childEntity in _childEntities) { if (Debug.isDebugBuild) { // sizeof(int) weil die position um 4 nachruckt writer.Write(childEntity.ToString()); writer.Write((int)writer.GetStream().Position + sizeof(int)); } childEntity.OnReplayRecord(writer, info); if (Debug.isDebugBuild) { writer.Write((int)writer.GetStream().Position + sizeof(int)); } } }