private void HandleClicks() { if (!EventSystem.current.IsPointerOverGameObject()) { if ((Input.GetMouseButtonUp(0) && matchTimer.matchStarted)) { Ray screenToWorld = viewportCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(screenToWorld, out RaycastHit raycastHit)) { clickerAudio.PlayInspect(); Collider other = raycastHit.collider; switch (other.tag) { case "Building": ClearSelections(); selectedBuilding = other.GetComponentInParent <Building>(); selectedBuilding.FocusOnBuilding(); upgradeMenuObj.SetActive(true); //upgradeMenu.PopulateList(selectedBuilding.upgrades); upgradeMenu.SetSelectedBuilding(selectedBuilding); break; case "Plot": ClearSelections(); Building.UnfocusAllBuildings(); selectedPlot = other.GetComponentInParent <Plot>(); selectedPlot.FocusOnPlot(); if (selectedPlot.size == (Plot.PlotSize) 0) { buildMenuObj[2].SetActive(true); } else if (selectedPlot.size == (Plot.PlotSize) 1) { buildMenuObj[0].SetActive(true); } else if (selectedPlot.size == (Plot.PlotSize) 2) { buildMenuObj[1].SetActive(true); } break; case "Forest": ClearSelections(); selectedForest = other.GetComponent <Forest>(); buyTileMenu.SetSelectedTile(selectedForest); buyMenuObj.SetActive(true); if (!selectedForest.finished) { buyTileMenu.buildButtons[0].SetActive(true); } if (selectedForest.building) { buyTileMenu.buildButtons[0].SetActive(false); buyTileMenu.buildButtons[1].SetActive(true); buyTileMenu.buildButtons[1].GetComponent <Button>().interactable = false; } if (selectedForest.finished) { buyTileMenu.buildButtons[1].SetActive(true); buyTileMenu.buildButtons[1].GetComponent <Button>().interactable = true; } break; case "Rock": ClearSelections(); selectedRock = other.GetComponent <Rock>(); buyTileMenu.SetSelectedTile(selectedRock); buyMenuObj.SetActive(true); if (!selectedRock.finished) { buyTileMenu.buildButtons[3].SetActive(true); } if (selectedRock.building) { buyTileMenu.buildButtons[3].SetActive(false); buyTileMenu.buildButtons[4].SetActive(true); buyTileMenu.buildButtons[4].GetComponent <Button>().interactable = false; } if (selectedRock.finished) { buyTileMenu.buildButtons[4].SetActive(true); buyTileMenu.buildButtons[4].GetComponent <Button>().interactable = true; } break; case "WorldTile": ClearSelections(); selectedTile = other.GetComponent <WorldTile>(); selectedTile.GetComponent <Animator>().SetBool("Focused", true); buyTileMenu.SetSelectedTile(selectedTile); if (!selectedTile.purchased) { buyMenuObj.SetActive(true); buyTileMenu.buildButtons[2].SetActive(true); } break; case "SkullIsland": bombCounter++; Debug.Log(bombCounter); nukeSource = nukeAudio.GetComponent <AudioSource>(); nukeSource.PlayOneShot(nukeAudio.dontDoIt[bombCounter - 1]); if (bombCounter == 5) { nuke = other.GetComponent <NukeTime>(); nuke.nukeTime(); } break; default: ClearSelections(); break; } } } } }