示例#1
0
    IEnumerator play()
    {
        float  timeToWait = millisecondsToWait / 1000f;
        string nextLine;

        while (songLines.Count != 0)
        {
            yield return(new WaitForSeconds(timeToWait));

            nextLine = songLines.Dequeue();
            if (nextLine[0].ToString() == "1")
            {
                nf.spawnBlock(laneNumber.lane1, blockType.note);
            }
            if (nextLine[1].ToString() == "1")
            {
                nf.spawnBlock(laneNumber.lane2, blockType.note);
            }
            if (nextLine[2].ToString() == "1")
            {
                nf.spawnBlock(laneNumber.lane3, blockType.note);
            }
            if (nextLine[3].ToString() == "1")
            {
                nf.spawnBlock(laneNumber.lane4, blockType.note);
            }
            if (nextLine[4].ToString() == "1")
            {
                nf.spawnBlock(laneNumber.lane5, blockType.note);
            }
        }

        Application.Quit();
    }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         factory.spawnBlock(laneNumber.lane1, blockType.note);
     }
     if (Input.GetKeyDown(KeyCode.W))
     {
         factory.spawnBlock(laneNumber.lane2, blockType.note);
     }
     if (Input.GetKeyDown(KeyCode.E))
     {
         factory.spawnBlock(laneNumber.lane3, blockType.note);
     }
     if (Input.GetKeyDown(KeyCode.R))
     {
         factory.spawnBlock(laneNumber.lane4, blockType.note);
     }
     if (Input.GetKeyDown(KeyCode.T))
     {
         factory.spawnBlock(laneNumber.lane5, blockType.note);
     }
 }