Esempio n. 1
0
        // 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);
        }
Esempio n. 2
0
        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++;
            }
        }
Esempio n. 3
0
        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++;
            }
        }