Example #1
0
    void Update()
    {
        timer += Time.deltaTime;

        if (startTime == 0)
        {
            startTime = DateTime.Now.Ticks;
        }

        //gets latest timing points
        long offsetTime = (DateTime.Now.Ticks - startTime) / TimeSpan.TicksPerMillisecond;

        if (timingIndex >= timingPointsList.Count && offsetTime >= timingPointsList[timingIndex].getOffset())
        {
            if (timingPointsList[timingIndex].getPlaymode() == 0) //note mode
            {
                baseScore = noteBaseScore;
                simonSaysController.GetComponent <simonSaysManager>().disableInput();
            }
            else
            {
                baseScore = simSaysBaseScore;
                simonSaysController.GetComponent <simonSaysManager>().enableInput();
            }
            timingIndex++;
        }

        //generate notes for simon says and ddr
        while (index < hitObjectsList.Count)
        {
            offsetTime = (DateTime.Now.Ticks - startTime) / TimeSpan.TicksPerMillisecond;
            HitObject hitObject = hitObjectsList[index];

            if (offsetTime >= hitObject.getOffset())
            {
                if (hitObject.isFlashRed())
                {
                    simonSaysController.GetComponent <simonSaysManager>().StoreBleep(0);
                }
                if (hitObject.isFlashBlue())
                {
                    simonSaysController.GetComponent <simonSaysManager>().StoreBleep(1);
                }
                if (hitObject.isFlashYellow())
                {
                    simonSaysController.GetComponent <simonSaysManager>().StoreBleep(2);
                }
                if (hitObject.isFlashGreen())
                {
                    simonSaysController.GetComponent <simonSaysManager>().StoreBleep(3);
                }
                if (hitObject.IsNote())
                {
                    noteController.GetComponent <NotesController>().spawnNotes(hitObject);
                }
                index++;
            }
            else //if next hit object dont need to be spawned now
            {
                break;
            }
        }

        Debug.Log(timer);
        if (timer >= songLength)
        {
            SceneManager.LoadScene("RankingPanel");
        }

        // Start bleep input
        // Receive bleep status


        // End bleep input
    }