void Update() { if (gameC.getCurrentGameState() != GameState.GAMEOVER) { if (gameC.getCurrentGameState() == GameState.INGAME) { normalSp(); } else if (gameC.getCurrentGameState() == GameState.INGAME) { ultraSp(); } if (isBomb) { string posTemp = ScreenController.posToM(); if (posTemp == "esq") { transform.eulerAngles = new Vector3(0f, 0f, -18f); } else if (posTemp == "dir") { transform.eulerAngles = new Vector3(0f, 0f, 18f); } else { transform.eulerAngles = new Vector3(0f, 0f, 0f); } } if (transform.position.x > 5.2) { transform.position = new Vector2(5.2f, transform.position.y); } if (transform.position.x < -5.2) { transform.position = new Vector2(-5.2f, transform.position.y); } if (transform.position.y > YtoActive) { gameObject.SetActive(true); } if (transform.position.y < -9) { gameObject.SetActive(false); transform.position = startPos; } else { //transform.position = new Vector3(XAbs, transform.position.y); transform.position -= new Vector3(0f, speed, 0f) * Time.deltaTime; } } }
void Update() { currentTimeToChangeAd += Time.deltaTime; if (currentTimeToChangeAd > timeToChangeTopAd) { changeTopAD(); currentTimeToChangeAd = 0f; } if (CentralAD) { loadingAD(); CentralAD = false; checkADisLoad = true; } if (checkADisLoad) { if (interstitialADCentral.IsLoaded() && currentGameState.Equals(GameState.GAMEOVER)) { interstitialADCentral.Show(); checkADisLoad = false; } } switch (currentGameState) { case GameState.START: { if (isStart) { scenarioC.randomWorld(); isStart = false; } currentTimeToShowLogoAnimation += Time.deltaTime; if (currentTimeToShowLogoAnimation > timeToShowLogoAnimation) { tutorialContent.SetActive(false); score.SetActive(false); startContent.SetActive(true); bottomContent.SetActive(true); } } break; case GameState.TUTORIAL: { //arrows.SetActive(false); startContent.SetActive(false); tutorialContent.SetActive(true); bottomContent.SetActive(false); } break; case GameState.PREGAME: { arrows.SendMessage("setArrow", "none", SendMessageOptions.RequireReceiver); bannerADTop.Show(); score.SetActive(true); //arrows.SetActive(false); preGameLoad.SetActive(true); bottomContent.SetActive(false); startContent.SetActive(false); gameOverContent.SetActive(false); } break; case GameState.INGAME: { AnalyControll = true; score.SetActive(true); //arrows.SetActive(true); string posTemp = ScreenController.posToM(); if (posTemp == "esq") { lastP = "esq"; if (arrows.activeSelf) { arrows.SendMessage("setArrow", "esq", SendMessageOptions.RequireReceiver); } Scene.transform.position -= new Vector3(speed, 0, 0) * Time.deltaTime; } else if (posTemp == "dir") { lastP = "dir"; if (arrows.activeSelf) { arrows.SendMessage("setArrow", "dir", SendMessageOptions.RequireReceiver); } Scene.transform.position += new Vector3(speed, 0, 0) * Time.deltaTime; } } break; case GameState.GAMEOVER: { if (AnalyControll) { addOneGameToCountAD(); achievementsC.Analysis(); AnalyControll = false; ravenS.isGameOver(); } score.SetActive(false); currentGameTimeGameOverAgain += Time.deltaTime; if (currentGameTimeGameOverAgain > timeToGameOverAgain) { currentGameTimeGameOverAgain = 0; gameOverAgain = true; } gameOverContent.SetActive(true); bottomContent.SetActive(true); } break; case GameState.SHOP: { //arrows.SetActive(false); shopContent.SetActive(true); gameOverContent.SetActive(false); bottomContent.SetActive(false); startContent.SetActive(false); } break; case GameState.ACHIEVES: { //arrows.SetActive(false); achievementsContent.SetActive(true); gameOverContent.SetActive(false); bottomContent.SetActive(false); startContent.SetActive(false); Scene.SendMessage("restart", SendMessageOptions.RequireReceiver); } break; } }