Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other is CircleCollider2D)
     {
         GameObject obj = other.gameObject;
         BallStuff  bs  = obj.GetComponent <BallStuff>();
         if (bs == null)
         {
             Destroy(gameObject);
         }
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     //collision with the goal net
     if (other is PolygonCollider2D)
     {
         pc.DecreasePlayerScore(value);
         Destroy(gameObject);
     }
     else if (other is CircleCollider2D)
     {
         GameObject obj = other.gameObject;
         BallStuff  bs  = obj.GetComponent <BallStuff>();
         if (bs != null)
         {
             Destroy(gameObject);
         }
     }
 }