示例#1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Player")
     {
         scoreManager.AddGem(GemValue);
         Destroy(gameObject);
     }
 }
示例#2
0
 private void OnTriggerEnter2D(Collider2D c)
 {
     Debug.Log(c.tag);
     if (c.tag == "Hazard")
     {
         TakeDamage();
         Destroy(c.gameObject);
         SoundManager.PlaySound(SoundManager.Instance.BadGemSound);
     }
     else if (c.tag == "GoodGem")
     {
         Handheld.Vibrate();
         GoodGem g = c.GetComponent <GoodGem>();
         ScoreManager.AddGem(g);
         Destroy(c.gameObject);
         SoundManager.PlaySound(SoundManager.Instance.GoodGemSound);
     }
 }