void Update() { if (scene == SCENE.Home) { if (!gameInitialized) { gameInitialized = InitializeGame(); } SelectHomeMenu(); } else if (scene == SCENE.Rule) { if (!LookThourghRule()) { soundC.PlaySelect(); scene = SCENE.Home; } } else if (scene == SCENE.SelectLevel) { if (SelectLevel()) { scene = SCENE.Play; uiC.UpdateHomeUI(false); uiC.UpdateSelectLevelPanel(false); InvisibleWall.SetActive(true); } } else if (scene == SCENE.Play) { // Getting Ready for Game if (!gamePlaying) { // Set gamePlaying (true) in Coroutine StartCoroutine(uiC.ReadyClusterUI()); // Initializing Time timeC.InitializeTime(ref gameTime); uiC.InitializeTimeSlider(gameTime); uiC.UpdateGameUI(true); // Instantiating OtherBee if (!otherBeeC.initialized) { otherBeeC.InitializeOtherBee(); } bee.StartBuzzing(); } // GamePlaying else { if (gameOver) { BGM.Stop(); bee.StopBuzzing(); soundC.PlayWhistleSE(); scoreC.SetScore(gameTime); otherBeeC.DestroyOtherBee(); StartCoroutine(ChangeToResultWithDelay(1.5f)); gamePlayedOnce = true; InvisibleWall.SetActive(false); } else { // Updating Time timeC.UpdateTime(ref gameTime); uiC.UpdateTimeSlider(gameTime); // Move Bee bee.MoveHorizontally(); bee.MoveVertically(); if (remainingChanged) { UpdateRemainingBee(); } } } } else if (scene == SCENE.Result) { uiC.ShowResultUI(); if (timeOver) { soundC.PlayGameLose(); BackToHome(); } else { soundC.PlayGameWin(); SelectResultMenu(); } } else if (scene == SCENE.Ranking) { // Do nothing } }
// Update is called once per frame void Update() { if (scene == SCENE.Home) { SelectHomeMenu(); } else if (scene == SCENE.Rule) { if (!LookThourghRule()) { soundC.PlaySelect(); scene = SCENE.Home; } } else if (scene == SCENE.Play) { // Getting Ready for Game if (!gamePlaying) { // Set gamePlaying (true) in Coroutine StartCoroutine(uiC.ReadyHuntingUI()); // Initializing Time timeC.InitializeTime(ref gameTime); uiC.InitializeTimeSlider(gameTime); uiC.UpdateGameUI(true); // Instantiating OtherBee if (!otherBeeC.initialized) { otherBeeC.InitializeOtherBee(); } beeHunter.StartBuzzing(); } // GamePlaying else { if (gameOver) { BGM.Stop(); beeHunter.StopBuzzing(); soundC.PlayWhistleSE(); scoreC.SetScore(gameScore); otherBeeC.DestroyOtherBee(); StartCoroutine(ChangeToResultWithDelay(0.5f)); } else { // Updating Time timeC.UpdateTimeForBeeHunter(ref gameTime); uiC.UpdateTimeSlider(gameTime); // Move Hunter beeHunter.Move(); } if (hunted) { UpdateHuntedBee(); } } } else if (scene == SCENE.Result) { soundC.PlayGameWin(); if (LoadRankingScene()) { scene = SCENE.Ranking; } } else if (scene == SCENE.Ranking) { // Do nothing } }