示例#1
0
    void Start()
    {
        Beatmap.CurrentlyLoaded = new Beatmap()
        {
            SliceCount = 8,
            Bpm        = 120,
        };
        Beatmap.CurrentlyLoaded.Notes = new Queue <Note>(new Note[] {
            new Note()
            {
                Slice = 1, Tick = 50
            },
            new Note()
            {
                Slice = 2, Tick = 70
            }
        });

        List <NoteSliderObject> noteSliders = new List <NoteSliderObject>();

        for (int i = 0; i < Beatmap.CurrentlyLoaded.SliceCount; i++)
        {
            var noteSlider = new GameObject("NoteSlider" + i, typeof(NoteSliderObject)).GetComponent <NoteSliderObject>();

            noteSlider.Triangle           = GetTriangleForSlice(i, 4);
            noteSlider.Material           = NoteSliderMaterial;
            noteSlider.Slice              = i;
            noteSlider.transform.rotation = Quaternion.Euler(0, 0, -(360 / Beatmap.CurrentlyLoaded.SliceCount) * i + 180);

            noteSliders.Add(noteSlider);
        }
        NoteSlider = noteSliders.ToArray();

        Rhythm.OnTick += (int beat) => {
            Note temp;
            for (int i = 0; !((temp = Beatmap.CurrentlyLoaded.GetNoteAt(i)) == null) && temp.TicksToThis <= SpawningTick; i++)
            {
                Beatmap.CurrentlyLoaded.RemoveNote(temp);
                NoteObject.Create(temp);
                temp.isLoaded = true;
            }
        };
        Rhythm.Running = true;
    }