Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (currentScenario != GameOverScenario)
     {
         // when this timer expires, the CSR has waiting too long to respond
         // transition to DelayScenario
         // if we're in DelayScenario, transition to GameOverScenario
         timer -= Time.deltaTime;
         int    seconds  = Mathf.FloorToInt(timer);
         string niceTime = string.Format("0:{0:00}", seconds);
         responseTimerText.text = niceTime.ToString();
         if (timer <= 0.0f)
         {
             timer = maxResponseTime;
             if (currentScenario != DelayScenario)
             {
                 stressButton.joltStress();
                 lastScenario = currentScenario;
                 LoadScenario(DelayScenario);
             }
             else
             {
                 currentScenario = GameOverScenario;
                 dragon.stopDragonTimer();
                 stressButton.stopStress();
                 LoadScenario(GameOverScenario);
             }
         }
     }
     else
     {
         dragon.stopDragonTimer();
         stressButton.stopStress();
     }
 }