private void ChangeScene(Structs.GameScene to) { currentScene = to; //Debug.Log("Change scene to: " + currentScene); switch (currentScene) { case Structs.GameScene.Initialization: SwitchToMenu(); break; case Structs.GameScene.Menu: managerInput.SetEvents(); managerUI.SetPanels(); break; case Structs.GameScene.LoadingGame: gameManager.ResetGame(); gameManager.StartGame(); managerUI.SetPanels(); managerCamera.SwitchToCamera(ManagerCamera.Cameras.Static); // And go! SwitchToIngame(); break; case Structs.GameScene.Ingame: gameManager.OnEndGame += GameEnd; managerInput.SetEvents(); managerUI.SetPanels(); break; case Structs.GameScene.GameEnd: gameManager.OnEndGame -= GameEnd; managerCamera.SwitchToCamera(ManagerCamera.Cameras.Motion); //gameManager.ResetGame(); // not necessary managerUI.SetCurrentPlayer(GameManager.Players.None.ToString()); //managerUI.SetWinner( gameManager.GetCurrentPlayer().ToString() ); SwitchToScore(); break; case Structs.GameScene.Score: managerInput.SetEvents(); managerUI.SetPanels(); break; case Structs.GameScene.Exit: Application.Quit(); break; } }
private void ChangeScene(Structs.GameScene to) { currentScene = to; //Debug.Log("Change scene to: " + currentScene); switch (currentScene) { case Structs.GameScene.Initialization: SwitchToMenu(); break; case Structs.GameScene.Menu: managerInput.SetEvents(); managerUI.SetPanels(); break; case Structs.GameScene.LoadingGame: //InitMap(); //entityManager.Init(); //GameInitialize(); //InitPlayer(); //InitCamera(); //SetCameraOnPlayer(); //GameStart(); // If we are in 2 player modes, or 3 player mode, change settings if (currentGameMode == Structs.GameMode.Multi3players) { remainingPlayers = 3; } else { remainingPlayers = 2; } managerUI.SetPanels(); SwitchToIngame(); break; case Structs.GameScene.Ingame: //inputManager.SetEvents(); //uiManager.UpdateUI(); Unpause(); managerMap.Reset(); managerMap.SummonMap(); managerEntity.Reset(); managerEntity.SummonPlayers(); ResetCamera(); if (managerEntity.playersScript[0] != null) { managerEntity.playersScript[0].OnDie += EndGameConditionChecker; managerEntity.playersScript[0].OnCollision += managerEntity.SummonHole; managerUI.SetPlayerSprite(0, managerEntity.playersScript[0].sprite.sprite); } if (managerEntity.playersScript[1] != null) { managerEntity.playersScript[1].OnDie += EndGameConditionChecker; managerEntity.playersScript[1].OnCollision += managerEntity.SummonHole; managerUI.SetPlayerSprite(1, managerEntity.playersScript[1].sprite.sprite); } if (currentGameMode == Structs.GameMode.Multi3players) { if (managerEntity.playersScript[2] != null) { managerEntity.playersScript[2].OnDie += EndGameConditionChecker; managerEntity.playersScript[2].OnCollision += managerEntity.SummonHole; managerUI.SetPlayerSprite(2, managerEntity.playersScript[2].sprite.sprite); } } managerInput.SetEvents(); managerUI.SetPanels(); break; case Structs.GameScene.Score: managerEntity.playersScript[0].OnCollision = null; managerEntity.playersScript[0].OnDie = null; managerEntity.playersScript[1].OnCollision = null; managerEntity.playersScript[1].OnDie = null; if (currentGameMode == Structs.GameMode.Multi3players) { managerEntity.playersScript[2].OnCollision = null; managerEntity.playersScript[2].OnDie = null; } managerInput.SetEvents(); managerUI.SetPanels(); break; case Structs.GameScene.GameEnd: managerEntity.Reset(); managerMap.Reset(); managerInput.SetEvents(); managerUI.SetPanels(); SwitchToMenu(); break; case Structs.GameScene.Exit: Application.Quit(); break; } }