コード例 #1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         battleController.ChamandoPerguntaDasBatalhasAtivas();
     }
 }
コード例 #2
0
    IEnumerator contadorDeTempo()
    {
        while (true)
        {
            yield return(new WaitForSeconds(1f));

            segundos++;
            if (segundos == 60)
            {
                minutos++;
                segundos = 0;
                if (minutos == 60)
                {
                    horas++;
                    minutos = 0;
                }
            }

            //30 min tempo maximo da avaliacao
            if (minutos == 30)
            {
                gameOver = true;
                battlesControl.FinalizarJogo();
            }


            if (!respondendo)
            {
                tempoParaPergunta--;
                if (tempoParaPergunta == 0)
                {
                    respondendo = true;
                    battlesControl.ChamandoPerguntaDasBatalhasAtivas();
                    tempoParaPergunta = 20;
                }
            }

            if (gameOver)
            {
                break;
            }

            string hh = horas.ToString(), mm = minutos.ToString(), ss = segundos.ToString();
            if (hh.Length == 1)
            {
                hh = "0" + hh;
            }
            if (mm.Length == 1)
            {
                mm = "0" + mm;
            }
            if (ss.Length == 1)
            {
                ss = "0" + ss;
            }
            tempoTxt.text = "Tempo: " + hh + ":" + mm + ":" + ss;
        }
    }