Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     try
     {
         Boat = other.gameObject.GetComponent <Boat>();;
     }
     catch { }
     try
     {
         Car = other.gameObject.GetComponent <Car>();;
     }
     catch { }
     try
     {
         Pedestrian = other.gameObject.GetComponent <Pedestrian>();;
     }
     catch { }
     try
     {
         Bike = other.gameObject.GetComponent <Bike>();;
     }
     catch { }
     //destroy
     try
     {
         Boat.DestroyGameObject();
     }
     catch { }
     try
     {
         Car.DestroyGameObject();
     }
     catch { }
     try
     {
         Pedestrian.DestroyGameObject();
     }
     catch { }
     try
     {
         Bike.DestroyGameObject();
     }
     catch { }
 }