Ejemplo n.º 1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "END")
     {
         //Stops the movement
         movement.finished = true;
         //Hides the GUI
         gui.SetActive(false);
         //Stops adding score
         manager.StopScore();
         shake.gameObject.transform.parent   = null;
         shake.gameObject.transform.rotation = Quaternion.Euler(new Vector3(rotationAngle, 0.0f, 0.0f));
     }
     if (other.tag == "Nuke")
     {
         //Sets off the nuclear detination
         nuke.SetActive(true);
         Invoke("WinGame", 7.0f);
     }
     if (!godMode)
     {
         if (other.tag == "Hazard")
         {
             //If you have not taken damage recently.
             if (!takenDamage)
             {
                 //Resets the values to restart the flashing effect
                 hazard.ResetValues();
                 hitSound.Play();
                 //Adds the heat to the engine
                 engine.engineHeatAmount += hazardHeatDamage;
                 //Shakes your screen
                 shake.StartShake();
                 //Enables a little shield
                 takenDamage  = true;
                 hazard.flash = true;
             }
         }
         if (other.tag == "DangerZone")
         {
             //Starts a timer for the duration that you are inside the danger zone
             startInTimer = true;
         }
     }
     if (other.tag == "Note")
     {
         //Resets the values to restart the flashing effect
         coolant.ResetValues();
         //Adds to the combo counter
         manager.comboScore += 1;
         //Adds to the total score
         manager.AddScore(10.0f);
         //Flashes the blue color over the gauge
         coolant.flash = true;
         //Cools the engine
         engine.CoolEngineByAmount(coolantAmount);
         //Starts the animation for the note collection
         other.GetComponent <Note>().Collected();
     }
 }