//检测是否生成下一个新音符
    void CheckSpawnNext()
    {
        int samplesToTarget = GetSpawnSampleOffset();

        int currentTime = gameController.DelayedSampleTime;

        while (pendingEventIdx < laneEvents.Count &&
               laneEvents[pendingEventIdx].StartSample < currentTime + samplesToTarget)
        {
            KoreographyEvent evt       = laneEvents[pendingEventIdx];
            int        noteNum         = evt.GetIntValue();
            NoteObject newObj          = gameController.GetFreshNoteObject();
            bool       isLongNoteStart = false;
            bool       isLongNoteEnd   = false;
            if (noteNum > 6)
            {
                isLongNoteStart = true;
                noteNum         = noteNum - 6;
                if (noteNum > 6)
                {
                    isLongNoteEnd   = true;
                    isLongNoteStart = false;
                    noteNum         = noteNum - 6;
                }
            }
            newObj.Initialize(evt, noteNum, this, gameController, isLongNoteStart, isLongNoteEnd);
            trackedNotes.Enqueue(newObj);
            pendingEventIdx++;
        }
    }
Exemple #2
0
    public void Initialize(List <GameNote> gameNotes)
    {
        List <NoteObject> noteObjects = new List <NoteObject>();

        foreach (GameNote gameNote in gameNotes)
        {
            NoteObject noteObject = Instantiate(notePrefab).GetComponent <NoteObject>();
            noteObject.transform.parent = this.transform;
            noteObject.Initialize(gameNote);
            noteObject.setColor(laneColor);
            noteObjects.Add(noteObject);
        }
        inactiveNotes = new Queue <NoteObject>(noteObjects);
        activeNotes   = new List <NoteObject>();
    }