示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.name == "ColliderBottom" && gameObject.tag == "Player")
     {
         Debug.Log("Destroy");
         Destroy(gameObject);
     }
     else if (collision.name == "ColliderTop" && gameObject.tag == "Player")
     {
         Debug.Log("Destroy");
         Destroy(gameObject);
     }
     else if (collision.tag == "Fish" && gameObject.tag == "Player")
     {
         Destroy(collision.gameObject);
         dataContainer.AddToScore(100);
     }
 }