Destroyable tile blocks with TilesExtra
still issues with collider
This commit is contained in:
@@ -12,10 +12,12 @@ public class Hammer : MonoBehaviour
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
var player = collision.collider.GetComponent<Player>();
|
||||
if (player == null)
|
||||
var mapElement = collision.collider.GetComponent<MapElement>();
|
||||
if (mapElement?.ElementSO.ElementType==MapElementType.BreakableWall)
|
||||
{
|
||||
Destroy(collision.gameObject);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user