コード例 #1
0
        public int strumFret(bool chord)
        {
            if (guitarNotes.Count == 0)
            {
                return(-1);
            }

            int        score = 0;
            GuitarNote note  = guitarNotes.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;
            }
            if (chord != note.isChord)
            {
                score = 0;
            }

            //Destroy(note.gameObject);
            note.gameObject.SetActive(false);
            return(score);
        }
コード例 #2
0
        private void checkForDespawnTiming()
        {
            if (guitarNotes.Count == 0)
            {
                return;
            }

            GuitarNote note = guitarNotes.Peek();

            if (songManager.getCurrentSongTime() - note.hitTime > badWindow)
            {
                guitarNotes.Dequeue();
                //Destroy(note.gameObject);
                note.gameObject.SetActive(false);
                feedbackRenderer.renderMiss();
                Score.player1Misses++;
            }
        }
コード例 #3
0
        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++;
            }
        }