コード例 #1
0
ファイル: BeatGenerator.cs プロジェクト: SNUGDC/Beat-It
    void Update()
    {
        // Dequeue & kill last note
        int curTime = (int)System.Math.Round(Time.timeSinceLevelLoad * 1000000);
        // find first note in READY State & show at appropriate time
        Note appearNote = null;

        foreach (Note n in NoteList)
        {
            if (!n.IsValid)
            {
                appearNote = n;
                break;
            }
        }

        Turnline appearLine = null;

        foreach (Turnline l in FlipList)
        {
            if (!l.IsValid)
            {
                appearLine = l;
                break;
            }
        }
        if (appearNote != null && curTime - _StartTime > appearNote.Time - NoteMover.NoteDelay * 1000000)
        {
            appearNote.Appear(NotePrefab);
        }
        if (appearLine != null && curTime - _StartTime > appearLine.Time - TurnlineMover.NoteDelay * 1000000)
        {
            appearLine.Appear(LinePrefab);
        }
        // play sound & kill note
        if (NoteList.Count != 0 && curTime >= NoteList.Peek().Time + _StartTime)
        {
            NoteList.Dequeue().Kill();
        }
        if (FlipList.Count != 0 && curTime >= FlipList.Peek().Time + _StartTime)
        {
            GameObject.Find("BattleManager").GetComponent <BattleManager>().FlipAttacker();
            FlipList.Dequeue();
        }
    }