IEnumerator updateScore() { while (true && serviceShip.isAlive() && serviceShip.isInputPaused()) { if (float.IsInfinity(gameMaster.getWaveTime())) { yield return(new WaitForSeconds(1f)); } else { yield return(new WaitForSeconds(gameMaster.getWaveTime())); } serviceScoreRegister.updateScore(serviceScoreRegister.printScore() + 1); gameMaster.setGameSpeed(gameMaster.getGameSpeed() + 1); } }
void Start() { serviceSceneTransition = GetComponent <ServiceSceneTransition>(); serviceScoreRegister = GetComponent <ServiceScoreRegister>(); GameObject.Find("/Canvas/BtnReplay").GetComponent <Button>().onClick.AddListener(serviceSceneTransition.goToSceneGamePlay); GameObject.Find("/Canvas/BtnQuitGameMenu").GetComponent <Button>().onClick.AddListener(serviceSceneTransition.goToSceneGameMenu); GameObject.Find("/Canvas/TextScore").GetComponent <Text>().text = "Pontuação: " + serviceScoreRegister.printScore(); }
// Update is called once per frame void Update() { if (serviceGameMaster.isPaused()) { GameObject.Find("/Canvas/CanvasPaused").GetComponent <Canvas>().enabled = true; } else { GameObject.Find("/Canvas/CanvasPaused").GetComponent <Canvas>().enabled = false; } GameObject.Find("Canvas/TextScore").GetComponent <Text>().text = "Pontuação: " + serviceScoreRegister.printScore(); }