示例#1
0
// Update is called once per frame
    void Update()
    {
        if (!playingLevel)
        {
            return;
        }

        SpawnWaves();

        if (Input.GetMouseButtonDown(0))
        {
            onClick();
        }

        if (db.levelData.data[db.level].difficulty != Difficulty.easy)
        {
            bool errors = cursor.CheckKeys();
            if (db.levelData.data[db.level].difficulty == Difficulty.hard && errors)
            {
                errorCount++;
                SFX.PlayOneShot(error);
                //Debug.Log("Error Count: " + errorCount);
            }
        }

        int openSpaces = document.CountOpenSpaces();

        clock.text        = secondsToClock(levelStartTime + db.levelData.data[db.level].levelDuration - Time.time);
        spaceCounter.text = "Spaces " + openSpaces + "/" + document.spaces.Count;

        if (Time.time >= levelStartTime + db.levelData.data[db.level].levelDuration)
        {
            playingLevel = false;
            StartCoroutine(ToEvaluation());
            Debug.Log("Time Up");
        }

        if (openSpaces == 0)
        {
            playingLevel = false;
            StartCoroutine(OutOfSpace());
            Debug.Log("Out of Space[s]");
        }
    }