private void Update() { if (isPlaying) { tempoCounter += Time.deltaTime; if (tempoCounter >= pulse) { beatManager.UpdateBeat(); if (currentSentence[sentenceIndice] == 1) { var x = levelInfos.getCurrentPatterns(PlayerPrefs.GetInt("levelPlayed"), currentPart); monsterManager.updateMonsters(x); turretManager.TempoUpdate(); } sentenceIndice++; if (sentenceIndice >= currentSentenceLength) { if (ggEz) { Win(); } currentSentence = musicManager.getNextSentence(goNext); beatManager.loadSentence(currentSentence); currentSentenceLength = currentSentence.GetLength(0); sentenceIndice = 0; goNext = false; } tempoCounter -= pulse; pulseCounter++; } if (pulseCounter == 4) { tilemapManager.updateTiles(); pulseCounter = 0; } } else { SceneManager.LoadScene("MainMenu"); } }