private void Explode() { MapScript map = GameManagerScript.Instance.Map; // Center map.ExplodeTile(_position.x, _position.y); // Right for (int i = 1; i < Radius + 1; i++) { if (map.GetTerrainTypeAtPos(_position.x + i, _position.y) == TerrainType.Wall) { break; } map.ExplodeTile(_position.x + i, _position.y); } // Left for (int i = 1; i < Radius + 1; i++) { if (map.GetTerrainTypeAtPos(_position.x - i, _position.y) == TerrainType.Wall) { break; } map.ExplodeTile(_position.x - i, _position.y); } // Top for (int i = 1; i < Radius + 1; i++) { if (map.GetTerrainTypeAtPos(_position.x, _position.y + i) == TerrainType.Wall) { break; } map.ExplodeTile(_position.x, _position.y + i); } // Bottom for (int i = 1; i < Radius + 1; i++) { if (map.GetTerrainTypeAtPos(_position.x, _position.y - i) == TerrainType.Wall) { break; } map.ExplodeTile(_position.x, _position.y - i); } gameObject.SetActive(false); }