Destroyable tile blocks with TilesExtra

still issues with collider
This commit is contained in:
2023-06-28 19:58:30 +03:00
parent c79d2a6b49
commit 2dfece0eb0
9 changed files with 1745 additions and 47 deletions
+4 -2
View File
@@ -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);
}
}
}