// If drum note is present in queue, removes the drum and returns the score for the note public int hitDrum() { if (drumNotes.Count == 0) { return(-1); } int score = 0; DrumNote note = drumNotes.Dequeue(); if (Mathf.Abs(songManager.getCurrentSongTime() - note.hitTime) < excellentWindow) { score = 3; } else if (Mathf.Abs(songManager.getCurrentSongTime() - note.hitTime) < goodWindow) { score = 2; } else if (Mathf.Abs(songManager.getCurrentSongTime() - note.hitTime) < badWindow) { score = 1; } //Destroy(note.gameObject); note.gameObject.SetActive(false); return(score); }
private void checkForNoteSpawn() { if (noteNum == beatMap.numNotesDrum) { return; } if (beatMap.noteTimesDrum[noteNum] - songManager.getCurrentSongTime() <= beatMap.approachTimeDrum) { int location = beatMap.noteLocationsDrum[noteNum]; // spawn a note //DrumNote drumNote = Instantiate(drumNotePrefab, drums[location].transform.position, Quaternion.identity); DrumNote drumNote = ObjectPooler.Instance.SpawnFromPool("DrumNote", drums[location].transform.position, Quaternion.identity).GetComponent <DrumNote>(); // initialize note hit time and shrink rate drumNote.initialize(beatMap.noteTimesDrum[noteNum], beatMap.approachTimeDrum); // send note to the corresponding drum drums[location].drumNotes.Enqueue(drumNote); // move onto the next note noteNum++; } }
private void checkForDespawnTiming() { if (drumNotes.Count == 0) { return; } DrumNote note = drumNotes.Peek(); if (songManager.getCurrentSongTime() - note.hitTime > badWindow) { drumNotes.Dequeue(); //Destroy(note.gameObject); note.gameObject.SetActive(false); feedbackRenderer.renderMiss(); Score.player2Misses++; } }