IEnumerator DisplayCall()
    {
        yield return(new WaitForSeconds(sec));

        gameHandler.GetComponent <ReadMCQ>().nextQns();
        MCQ_UI.SetActive(true);
    }
 void checkAns()
 {
     if (Ans1Sel && currMCQs[2] == "T")
     {
         Debug.Log("Correct");
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
     }
     else if (Ans2Sel && currMCQs[4] == "T")
     {
         Debug.Log("Correct");
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
     }
     else if (Ans3Sel && currMCQs[6] == "T")
     {
         Debug.Log("Correct");
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
     }
     else if (Ans4Sel && currMCQs[8] == "T")
     {
         Debug.Log("Correct");
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
     }
     else
     {
         Debug.Log("Incorrect");
     }
     MCQ_UI.SetActive(false);
     StartCoroutine(DisplayCall());
 }
Beispiel #3
0
    IEnumerator DisplayCall()
    {
        yield return(new WaitForSeconds(sec));

        RanMsg.SetActive(false);
        gameHandler.GetComponent <ReadMCQ>().nextQns();
        if (isPlayerDead)
        {
            GameOver_MSG.SetActive(true);
        }
        else if (isGameEnd)
        {
            Clear_Msg.SetActive(true);
            //put method and go back to world selection
        }
        else if (!isGameEnd)
        {
            Ans1Sel = false;
            Ans2Sel = false;
            Ans3Sel = false;
            Ans4Sel = false;
            Ans1.GetComponent <TextBG>().Unselectedbtn();
            Ans2.GetComponent <TextBG>().Unselectedbtn();
            Ans3.GetComponent <TextBG>().Unselectedbtn();
            Ans4.GetComponent <TextBG>().Unselectedbtn();
            MCQ_UI.SetActive(true);
            timeUP      = false;
            timeAtkMode = timeAtkMode1;
        }
    }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        float Tmin = Mathf.FloorToInt(timerMinutes / 60);
        float TSec = Mathf.FloorToInt(timerSeconds % 60);

        timerMinutes += Time.deltaTime;
        timerSeconds += Time.deltaTime;

        timerUpload = string.Format("{0:00}:{1:00}", Tmin, TSec);
        //Debug.Log(timerUpload);

        if ((gameMode == 1 || isHarderMode) && !isGameEnd && !isPlayerDead)
        {
            float seconds = Mathf.FloorToInt(timeAtkMode % 60);
            topTextDisplay[0].text = string.Format("{0:00}:{1:00}", "0", seconds);
            if (!timeUP)
            {
                if (timeAtkMode > 0)
                {
                    timeAtkMode -= Time.deltaTime;
                }
                else
                {
                    Debug.Log("Time has run out!");
                    timeAtkMode = 0;
                    timeUP      = true;
                    gameHandler.GetComponent <ReadMCQ>().saveWrongQns(currMCQs);
                    player.GetComponent <PlayerCharacter>().deductHP();
                    enemyHandler.GetComponent <Enemy>().EnemyAtk();
                    MCQ_UI.SetActive(false);
                    if (!enemyHandler.GetComponent <Enemy>().isBossSpawn)
                    {
                        StartCoroutine(DisplayRanMsg());
                        enemyHandler.GetComponent <Enemy>().EnemyRan();
                    }
                    StartCoroutine(DisplayCall());
                }
            }
        }
    }
Beispiel #5
0
 void checkAnsInverse()
 {
     if ((Ans1Sel && currMCQs[2] == "F") && (Ans2Sel && currMCQs[4] == "F") && (Ans3Sel && currMCQs[6] == "F") && (!Ans4Sel && currMCQs[8] == "T"))
     {
         //Debug.Log("Correct");
         score++;
         increaseDiff();
         if (enemyHandler.GetComponent <Enemy>().isBossSpawn)
         {
             enemyHandler.GetComponent <Enemy>().deductHP(1);
         }
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
         player.GetComponent <PlayerCharacter>().playAtkAni();
     }
     else if ((Ans1Sel && currMCQs[2] == "F") && (Ans2Sel && currMCQs[4] == "F") && (Ans4Sel && currMCQs[8] == "F") && (!Ans3Sel && currMCQs[6] == "T"))
     {
         score++;
         increaseDiff();
         if (enemyHandler.GetComponent <Enemy>().isBossSpawn)
         {
             enemyHandler.GetComponent <Enemy>().deductHP(1);
         }
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
         player.GetComponent <PlayerCharacter>().playAtkAni();
     }
     else if ((Ans1Sel && currMCQs[2] == "F") && (Ans3Sel && currMCQs[6] == "F") && (Ans4Sel && currMCQs[8] == "F") && (!Ans2Sel && currMCQs[4] == "T"))
     {
         score++;
         increaseDiff();
         if (enemyHandler.GetComponent <Enemy>().isBossSpawn)
         {
             enemyHandler.GetComponent <Enemy>().deductHP(1);
         }
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
         player.GetComponent <PlayerCharacter>().playAtkAni();
     }
     else if ((Ans2Sel && currMCQs[4] == "F") && (Ans3Sel && currMCQs[6] == "F") && (Ans4Sel && currMCQs[8] == "F") && (!Ans1Sel && currMCQs[2] == "T"))
     {
         score++;
         increaseDiff();
         if (enemyHandler.GetComponent <Enemy>().isBossSpawn)
         {
             enemyHandler.GetComponent <Enemy>().deductHP(1);
         }
         enemyHandler.GetComponent <Enemy>().EnemyDeath();
         player.GetComponent <PlayerCharacter>().playAtkAni();
     }
     else
     {
         Debug.Log("Incorrect");
         //Save the questions and reuse the questions at the back
         gameHandler.GetComponent <ReadMCQ>().saveWrongQns(currMCQs);
         player.GetComponent <PlayerCharacter>().deductHP();
         if (!enemyHandler.GetComponent <Enemy>().isBossSpawn)
         {
             StartCoroutine(DisplayRanMsg());
             enemyHandler.GetComponent <Enemy>().EnemyRan();
         }
         enemyHandler.GetComponent <Enemy>().EnemyAtk();
         HPRemain--;
         updateHP();
     }
     setColor();
     MCQ_UI.SetActive(false);
     StartCoroutine(DisplayCall());
 }