public override void OnGameStart() { base.OnGameStart(); PresentationHelpers.PresentationWorld.GetExistingSystem <TickSimulationSystem>().PauseSimulation(LEVEL_NOT_STARTED); SyncedValues.RegisterValueListener <SyncedValueCurrentLevel>(OnLevelSet, callImmediatelyIfValueExits: true); string levelToPlay = null; if (SyncedValues.CanWriteValues) { switch (GameStateManager.currentGameState) { case GameStateInGameServer serverGameState: levelToPlay = serverGameState.LevelToPlay; break; case GameStateInGameLocal localGameState: levelToPlay = localGameState.LevelToPlay; break; // CLIENT DOESN'T GET TO CHOOSE !! } SyncedValues.SetOrCreate(new SyncedValueCurrentLevel() { Name = levelToPlay }); } }
public void StartLevel(string levelName) { if (!SystemReady) { Log.Error("LevelManagerSystem is not ready"); return; } if (SyncedValues.CanWriteValues) { SyncedValues.SetOrCreate(new SyncedValueCurrentLevel() { Name = levelName }); } else { Log.Error("Client cannot start a level. The server must do that."); } }