void InteractWithBoard(int action) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { Vector3 gridPosition = board.CalculateGridPosition(hit.point); if (!UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()) { if (action == 0 && board.CheckForBuildingAtPosition(gridPosition) == null) { if (city.Cash >= selectedBuilding.buildingCost) { city.DepositCash(-selectedBuilding.buildingCost); uiController.UpdateCityData(); city.buildingCount[selectedBuilding.buildingId]++; board.AddBuilding(selectedBuilding, gridPosition); } } } else if (action == 1) { city.DepositCash(board.CheckForBuildingAtPosition(gridPosition).buildingCost / 2); board.RemoveBuilding(gridPosition); uiController.UpdateCityData(); city.buildingCount[selectedBuilding.buildingId]--; } } }