Example #1
0
 /// <summary>
 /// Checks if player has touched either the lava plane or the finish trigger.
 /// Depending which, will pause the game and call cs.onWin()/cs.onLoss().
 /// Sets hasWonOrLost to TRUE and sets Time.timeScale to 0 to effectively pause game untill respawn.
 /// RESUBMISSION ADDITION: Added exception handling here.
 /// </summary>
 /// <param name="other">Object collided with</param>
 void OnTriggerEnter(Collider other)
 {
     //RESUBMISSION ADDITION: Added exception handling here.
     try
     {
         if (other.tag == "Finish")//end touch
         {
             cs.onWin();
             hasWonOrLost   = true;
             Time.timeScale = 0;
         }
         else if (other.tag == "Respawn")//lava touch
         {
             cs.onLoss();
             hasWonOrLost   = true;
             Time.timeScale = 0;
         }
     }
     catch (Exception e)
     {
         Debug.LogException(e, this);
     }
 }