private void FixedUpdate() { if (StateFile.HasChanged(Path)) { var bytes = StateFile.ReadBytes(Path); stateHistory.FromBytes(new ByteQueue(bytes)); count = stateHistory.Count; } if (count > 0) { if (isLive && isPlaying) { countPosition = count - 1; } else { countPosition = Math.Min(countPosition, count - 1); } state = stateHistory.GetState(countPosition); if (state != null) { StateToScene.SpawnEntities(state, clones, transform); StateToScene.DespawnEntities(state, clones); StateToScene.ApplyChangesToEntites(state, clones); } } if (isPlaying) { countPosition++; } }
private void Update() { var bytes = StateFile.ReadBytes(Path); stateMB.state.FromBytes(new ByteQueue(bytes)); StateToScene.SpawnEntities(stateMB.state, clones, transform); StateToScene.DespawnEntities(stateMB.state, clones); StateToScene.ApplyChangesToEntites(stateMB.state, clones); }
private void FixedUpdate() { if (StateFile.HasChanged(Path)) { var bytes = StateFile.ReadBytes(Path); deltaStateHistory.FromBytes(new ByteQueue(bytes)); count = deltaStateHistory.Count; } if (count > 0 && isPlaying) { var deltaState = deltaStateHistory.GetDeltaState(state.tick); if (deltaState != null) { state = (TransformState)deltaState.GenerateEndState(state); StateToScene.SpawnEntities(state, clones, transform); StateToScene.DespawnEntities(state, clones); StateToScene.ApplyChangesToEntites(state, clones); } tick = state.tick; } }
private void Update() { if (startState != null) { var t = (currentTick - startState.tick) / (endState.tick - startState.tick); State state = startState; if (t <= 0) { state = startState; } else if (t >= 1) { state = endState; } else { state = State.Lerp(startState, endState, t); } StateToScene.SpawnEntities(state, clones, transform); StateToScene.DespawnEntities(state, clones); StateToScene.ApplyChangesToEntites(state, clones); } }