示例#1
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Enemy"))
     {
         StartCoroutine(GameOver());
     }
     if (collision.CompareTag("Goal"))
     {
         StartCoroutine(Winning());
     }
     if (collision.CompareTag("Warp") && warpManager.activatedWarp.GetComponent <Warp>().canEnter)
     {
         if (!_teleportHasPlayed)
         {
             FindObjectOfType <AudioManager>().Play("Teleport");
             _teleportHasPlayed = true;
         }
         _teleportHasPlayed = false;
         StartCoroutine(WarpEnter(collision.gameObject));
     }
     if (collision.CompareTag("Key"))
     {
         if (!_keyHasPlayed)
         {
             FindObjectOfType <AudioManager>().Play("Key");
             _keyHasPlayed = true;
         }
         Destroy(collision.gameObject);
         goal.ActivateGoal();
     }
 }
示例#2
0
 public void ActivateGoal(bool left)
 {
     if (left)
     {
         leftGoal.ActivateGoal();
     }
     else
     {
         rightGoal.ActivateGoal();
     }
 }