// Use this for initialization void Start() { numGreatHit = 0; numGoodHit = 0; numOkHit = 0; numMissHit = 0; notes = new LinkedList <Note>(); // beatDurations = BeatCreator.instance.beatDurations; // // currentBeatIdx = 0; // // elapsedTime = beatDurations[currentBeatIdx++]; currentNoteType = NOTETYPE.SINGLE; comboText.GetComponent <TextMesh>().text = ""; comboValueText.GetComponent <TextMesh>().text = ""; StartCoroutine("StartGame"); }
void Update() { if (bGameOver) { gameOverElapsedTime -= Time.deltaTime; if (gameOverElapsedTime <= 0) { //Jump to score ranking scene gameoverText.SetActive(false); goldMedalLabel.SetActive(false); silverMedalLabel.SetActive(false); silverMedalLabel.SetActive(false); Application.LoadLevel("scoreRank"); } } else if (levelLoaded) { if (!_songStarted && Time.time - _startAdjustment >= _startSongDelay) { BeatCreator.instance.PlaySong(); _songStarted = true; } elapsedTime -= Time.deltaTime; if (elapsedTime <= 0.0) { if (currentBeatIdx < numBeatDuration) { elapsedTime += beatDurations[currentBeatIdx++]; } else { bGameOver = true; GameOver(); } //if (Random.value < 0.5) // SpawnNote(0, new Vector3(15.0f, 0.0f, 0.0f)); //else // SpawnNote(1, new Vector3(15.0f, 0.0f, 0.0f)); Note aNote = SpawnNote(Random.Range(0, noteTypes.Length - 1), new Vector3(15.0f, 0.0f, 0.0f)); //LauncherManager.Instance.LaunchFireworks('A', 2, 4); LauncherManager.Instance.LaunchFireworks(1, 1, aNote); if (currentBeatIdx == 2) { _startAdjustment = Time.time; //StartCoroutine("playSongWithDelay"); } //Randomly set the note mode to single or continuous if (currentNoteType == NOTETYPE.SINGLE) { if (Random.value < 0.1f) { currentNoteType = NOTETYPE.CONTINUOUS; } } else { } } CheckMissed(); /*if( !bStartPlayback ) * CheckPlayback();*/ } }