public void OnServerStateChanged(ServerState state) { switch (state) { case ServerState.Quickplay: case ServerState.Level: if (labyrinth != null) { labyrinth.gameObject.Destroy(); labyrinth = null; } labyrinth = Labyrinths.Resources.Instance .GetLabyrinthObject(GameManager.Instance.CurrentGame.CurrentLevel.Labyrinth) .Create(GameManager.Instance.CurrentGame.CurrentLevel.Labyrinth); labyrinth.GenerateLabyrinthVisual(); labyrinth.Init(enableCamera: true); labyrinth.Camera.OutputToTexture = false; roundText.gameObject.SetActive(true); roundText.text = GameManager.Instance.CurrentGame.LevelState == ServerState.Quickplay ? quickPlayString.Value : roundString.Value + (GameManager.Instance.CurrentGame.CurrentLevel.Number + 1).ToString(); break; case ServerState.Menu: break; default: roundText.gameObject.SetActive(false); if (labyrinth != null) { labyrinth.gameObject.Destroy(); labyrinth = null; } break; } }
// Set waiting room enabled when labyrinth disabled / destoryed public void OnLabyrinthChanged(Labyrinths.LabyrinthObject labyrinth) { if (labyrinth == null) { waitingForNextRoundRoom.gameObject.SetActive(true); } else if (labyrinth.gameObject == null) { waitingForNextRoundRoom.gameObject.SetActive(true); } else { waitingForNextRoundRoom.gameObject.SetActive(false); } }