/// <summary> /// Cancel new building placement /// </summary> public void CancelPlacement() { if (IsBuilding) { IsBuilding = false; input.CursorPosition -= Move; input.LBMPressed -= TryPlace; buildingGhost.Destroy(); buildingsManager.Enable(); } }
/// <summary> /// Destroy the building /// </summary> public void DestroyBuilding(IBuilding _building) { Vector2Int gridPos = _building.Position; Vector2Int extents = new Vector2Int(gridPos.x + _building.Width, gridPos.y + _building.Height); for (int y = gridPos.y; y < extents.y; y++) { for (int x = gridPos.x; x < extents.x; x++) { tiles[x, y].Empty = true; } } buildings.Remove(_building); _building.Destroy(); }
public void RemoveBuilding(IBuilding building) { building.Destroy(); _buildings.Remove(building); }