Exemplo n.º 1
0
    // Remove completed notes, add new ones
    void UpdateNotesList()
    {
        // Game over check
        if (common.gameOver)
        {
            return;
        }

        // Remove completed notes, assumes sequential removal
        while (notes.Count > 0 && notes.First.Value.state == NotesScript.NotesState.REMOVE)
        {
            Destroy(notes.First.Value.gameObject);
            notes.RemoveFirst();
        }

        // Add new notes
        while (notesIterator.hasNext())
        {
            // If in the look-ahead range
            if (notesIterator.nextTime() - common.musicTime < CommonScript.TIME_LOOKAHEAD)
            {
                GameObject  notesObject = (GameObject)Instantiate(notesPrefab);
                NotesScript note        = notesObject.GetComponent <NotesScript>();
                notesIterator.next(note);
                // Set note's position
                Vector3 position;
                float   timePoint  = note.time % CommonScript.TIME_SCROLL;
                float   multiplier = timePoint / CommonScript.TIME_SCROLL;
                switch (note.column)
                {
                case 0: position = notesPositionInit_0 - notesPositionDelta_0 * multiplier; break;

                case 1: position = notesPositionInit_1 - notesPositionDelta_1 * multiplier; break;

                case 2: position = notesPositionInit_2 - notesPositionDelta_2 * multiplier; break;

                case 3: position = notesPositionInit_3 - notesPositionDelta_3 * multiplier; break;

                default: position = new Vector3(0, 0, 0); break;                         // Error
                }
                notesObject.transform.position = position;
                exSprite sprite = notesObject.GetComponent <exSprite>();
                sprite.color = new Color(1, 1, 1, 0);
                notes.AddLast(new LinkedListNode <NotesScript>(note));
            }
            else
            {
                break;
            }
        }

        // Check game done
        if (notes.Count == 0 && !notesIterator.hasNext())
        {
            slider.gameObject.active = false;
            common.OnGameOver();
        }
    }
Exemplo n.º 2
0
    // Remove completed notes, add new ones
    void UpdateNotesList()
    {
        // Game over check
        if (common.gameOver)
        {
            return;
        }

        // Remove completed notes, assumes sequential removal
        while (notes.Count > 0 && notes.First.Value.state == NotesScript.NotesState.REMOVE)
        {
            Destroy(notes.First.Value.gameObject);
            notes.RemoveFirst();
        }

        // Add new notes
        while (notesIterator.hasNext())
        {
            // If in the look-ahead range
            if (notesIterator.nextTime() - common.musicTime < CommonScript.TIME_LOOKAHEAD)
            {
                GameObject  notesObject = (GameObject)Instantiate(notesPrefab);
                NotesScript note        = notesObject.GetComponent <NotesScript>();
                notesIterator.next(note);
                notes.AddLast(new LinkedListNode <NotesScript>(note));
            }
            else
            {
                break;
            }
        }

        // Check game done
        if (notes.Count == 0 && !notesIterator.hasNext())
        {
            foreach (TapboxScript tapbox in tapboxes)
            {
                tapbox.gameObject.active = false;
            }
            common.OnGameOver();
        }
    }
Exemplo n.º 3
0
    void UpdateNotesList()
    {
        // Game over check
        if (common.gameOver)
        {
            return;
        }

        // Remove completed notes, assumes sequential removal
        while (notes.Count > 0 && notes.First.Value.state == NotesScript.NotesState.REMOVE)
        {
            Destroy(notes.First.Value.gameObject);
            notes.RemoveFirst();
        }

        // Add new notes
        while (notesIterator.hasNext())
        {
            // If in the look-ahead range
            if (notesIterator.nextTime() - common.musicTime < CommonScript.TIME_LOOKAHEAD)
            {
                GameObject  notesObject = (GameObject)Instantiate(notesPrefab);
                NotesScript note        = notesObject.GetComponent <NotesScript>();
                notesIterator.next(note);
                // For grid
                note.column += rowCount * 4;
                rowCount++;
                if (rowCount > 3)
                {
                    rowCount = 0;
                }
                Vector3 position;
                switch (note.column)
                {
                case 0: position = tapboxPosition_0; break;

                case 1: position = tapboxPosition_1; break;

                case 2: position = tapboxPosition_2; break;

                case 3: position = tapboxPosition_3; break;

                case 4: position = tapboxPosition_4; break;

                case 5: position = tapboxPosition_5; break;

                case 6: position = tapboxPosition_6; break;

                case 7: position = tapboxPosition_7; break;

                case 8: position = tapboxPosition_8; break;

                case 9: position = tapboxPosition_9; break;

                case 10: position = tapboxPosition_10; break;

                case 11: position = tapboxPosition_11; break;

                case 12: position = tapboxPosition_12; break;

                case 13: position = tapboxPosition_13; break;

                case 14: position = tapboxPosition_14; break;

                case 15: position = tapboxPosition_15; break;

                default: position = new Vector3(0, 0, 0); break;                         // Error
                }
                position += notesPositionOffset;
                note.gameObject.transform.position = position;
                // Add
                notes.AddLast(new LinkedListNode <NotesScript>(note));
            }
            else
            {
                break;
            }
        }

        // Check game done
        if (notes.Count == 0 && !notesIterator.hasNext())
        {
            foreach (TapboxScript tapbox in tapboxes)
            {
                tapbox.gameObject.active = false;
            }
            common.OnGameOver();
        }
    }