Esempio n. 1
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. 2
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++;
            }
        }
        private void checkForNoteSpawn()
        {
            if (noteNum == beatMap.numNotesGuitar)
            {
                return;
            }

            if (beatMap.noteTimesGuitar[noteNum] - songManager.getCurrentSongTime() <= beatMap.approachTimeGuitar)
            {
                int location = beatMap.noteLocationsGuitar[noteNum];

                // spawn a note
                //GuitarNote guitarNote = Instantiate(guitarNotePrefab, frets[location].transform.position - new Vector3(0, 8.5f, 0), Quaternion.identity);
                GuitarNote guitarNote = ObjectPooler.Instance.SpawnFromPool("GuitarNote", frets[location].transform.position - new Vector3(0, 8.5f, 0), Quaternion.identity).GetComponent <GuitarNote>();
                // initialize note hit time and velocity
                guitarNote.initialize(beatMap.noteTimesGuitar[noteNum], beatMap.noteTypesGuitar[noteNum] == 1, beatMap.approachTimeGuitar);

                // send note to the corresponding fret
                frets[location].guitarNotes.Enqueue(guitarNote);

                // move onto the next note
                noteNum++;
            }
        }