예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (testModeMaster)
        {
            // Debug.Log("test update");
            if (endTestB)
            {
                testEnd -= Time.deltaTime;
                if (testEnd < 0)
                {
                    endTestB = false;
                    testEnd  = .6f;
                    endTest();
                }
            }

            if (wrongAnswerGiven)
            {
                wrongDisp(wrongAn, wrongAnswer);
                addWrong();
                wrongAnswerGiven = false;
            }

            if (wrongAnswer >= 3)
            {
                failTest();
            }
            if (rightAnswer)
            {
                passTest();
            }


            if (bufftime)
            {
                buffT -= Time.deltaTime;
                if (buffT < 0)
                {
                    bufftime = false;
                    buffT    = 1f;
                    canShow  = true;
                }
            }

            //spawn timer
            if (isSpawning)
            {
                timeLeft -= Time.deltaTime;


                if (timeLeft < 0)
                {
                    timeLeft = interval;
                    popCube();
                }
            }

            //old bool answesGiven
            //checks spawn time then shows question
            if (hits > 3)
            {
                testing       = false;
                spawnAnsTime -= Time.deltaTime;
                if (spawnAnsTime < 0 || hits >= 11)
                {
                    if (canShow)
                    {
                        hits         = 0;
                        spawnAnsTime = interval;
                        giveQuest();
                        testing = true;
                        // answesGiven = false;
                        // canShow = false;
                        bufftime = true;
                    }
                }
            }


            //test mode count down
            if (testing && canShow)
            {
                testTime -= Time.deltaTime;
                if (testTime < tickTarg)
                {
                    tickTarg--;
                }

                if (testTime < 0)
                {
                    failTest();
                }
                timeCheck(tickTarg);
                //playes sound for count down
                if (soundTick != tickTarg)
                {
                    //  Debug.Log("test time: "+testTime+" tickTarg: "+ tickTarg);
                    master.playTick();
                    soundTick = tickTarg;
                }
            }
        }
        else
        {
            unspawn();
        }
    }