示例#1
0
 //Access to DeathZone
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "DeathZone")
     {
         audioScript.FallingSound();
         if (lives > 1)
         {
             gameObject.transform.position = new Vector3(0, 20, 0);
             lives--;
             print(gameObject + "lives: " + lives);
         }
         else
         {
             if (gameObject.name == "Player1")
             {
                 winningPlayer = "Robot";
             }
             else if (gameObject.name == "Player2")
             {
                 winningPlayer = "Wizard";
             }
             SceneManager.LoadScene("GameOver");
         }
     }
 }