void OnCollisionEnter2D() { if (_isDestroyable && _durability > 0) { _durability -= 1; } if (_durability == 0) { gameObject.SetActive(false); OnTileDestroy?.Invoke(this, EventArgs.Empty); } }
public static void RemoveTile(Vector3Int position) { backgroundTilemap.SetTile(position, GetTileType(position).backgroundTile); if (tiles.ContainsKey(position)) { tiles.Remove(position); } resistanceTilemap.SetTile(position, null); damageTilemap.SetTile(position, null); mainTilemap.SetTile(position, null); scriptTilemap.SetTile(position, null); OnTileDestroy?.Invoke(position, 10); }
public void OnDestroy() { OnTileDestroy?.Invoke(); }