void StartRecording() { _replayController.StartRecording(); ChecksumRecorderDebug checksumRecorderDebug = gameObject.GetComponent <ChecksumRecorderDebug> (); checksumRecorderDebug.Reset(); }
void Awake() { commandList = new CommandsList(); // ChecksumRecorder checksumRecorder = new ChecksumRecorder (new GameStateChecksumProvider (_gameStateBuilder, this)); // TODO: set replay.... gameFixedUpdate = new LockstepFixedUpdate(new CommandsListLockstepLogic(commandList, this)); gameFixedUpdate.GameFramesPerLockstep = gameFramesPerLockstep; gameFixedUpdate.FixedStepTime = fixedTimestepMilliseconds / 1000.0f; gameFixedUpdate.SetGameLogic(this); GameFixedUpdateDebug updateDebug = gameObject.AddComponent <GameFixedUpdateDebug> (); updateDebug.SetGameFixedUpdate(gameFixedUpdate); _checksumProvider = new GameStateChecksumProvider(this); ChecksumRecorderDebug checksumRecorderDebug = gameObject.AddComponent <ChecksumRecorderDebug> (); checksumRecorderDebug.checksumRecorder = new ChecksumRecorder(_checksumProvider); _commandSender = new CommandQueueBase(gameFixedUpdate, this); ResetGameState(); _replay = new MyCustomReplay(_checksumProvider, this); _replay.SaveInitialGameState(GetGameState()); _replayController = new ReplayController(gameFixedUpdate, _checksumProvider, recorderView, commandList, _replay); _replayController.GameFramesPerChecksumCheck = gameFramesPerChecksumCheck; StartRecording(); // debug... Application.targetFrameRate = 60; // commandList.AddCommand (new Command () { // CreationFrame = 0, // ProcessFrame = gameFixedUpdate.GetFirstLockstepFrame() // }); }