void OnMouseEnter() { //prevent clicking overgameObject if (EventSystem.current.IsPointerOverGameObject()) { return; } if (!buildManager.CanBuild) { return; } if (this.tag != "Node") { return; } if (buildManager.HasMoney) { rend.material.color = hoverColor; Turret tmp; if (buildManager.turretToBuild.prefab != null) { tmp = buildManager.turretToBuild.prefab.GetComponent <Turret>(); TurretRangeCircle.Draw_Range_Circle(range_circle, this, tmp.range); } } else { rend.material.color = notEnoughMoneyColor; } }
private void OnMouseExit() { if (TowerControl.selected.Count == 0) { TurretRangeCircle.Delete_Range_Circle(); } rend.material.color = startColor; }
private void OnMouseDown() { //prevent clicking overgameObject if (EventSystem.current.IsPointerOverGameObject()) { return; } /* if (!buildManager.CanBuild) * return;*/ if (turret != null || this.tag != "Node") { Debug.Log("Can't build there! - TODO: Display on Screen"); if (turret != null) { // < circle = (GameObject)Instantiate(select_circle, transform.position, transform.rotation); > if (TowerControl.selected.Count != 0) { TowerControl.delete_SelectionList(TowerControl.selected, TowerControl.selected_circle); } TowerControl.add_Node_To_SelectionList(this); // add selected node to list // < TowerControl.selected.Add(this); > TowerControl.DrawCircle(TowerControl.selected, select_circle); //draw circle on selected nodes turretStat = this.turret.GetComponent <Turret>(); TurretRangeCircle.Delete_Range_Circle(); TurretRangeCircle.Draw_Range_Circle(range_circle, this, turretStat.range); //Show the range of turret by drawing purple circle. is_selecting = true; SelectedUnitImage.update_image(this); //Show turret sprite and status for players. SelectedUnitStat.update_stat(this); //GeneralUIButton.PressCancelButton(); TowerControl.selected.TrimExcess(); TowerControl.selected_circle.TrimExcess(); //TrimExcess() for optimizing capacity in condition that has only one selected //model. May need to modify later if the list can hold more data. buildManager.UnselectTurretToBuild(); } //draw circle to notify user select this turret. /* else * Debug.Log(TowerControl.selected.Count);*/ return; } if (turret == null && TowerControl.selected.Count != 0) { TowerControl.delete_SelectionList(TowerControl.selected, TowerControl.selected_circle); //delete existing circle on clicking //empty node TurretRangeCircle.Delete_Range_Circle(); SelectedUnitImage.update_image(this); SelectedUnitStat.update_stat(this); } //Build a turret buildManager.BuildTurretOn(this); }
private void PressBuildButton() { A.SetActive(true); B.SetActive(true); C.SetActive(true); sell_button.SetActive(false); upgrade_button.SetActive(false); selected_unit_image.enabled = false; selected_unit_name.enabled = false; selected_unit_stat.enabled = false; TowerControl.delete_SelectionList(TowerControl.selected, TowerControl.selected_circle); TurretRangeCircle.Delete_Range_Circle(); }
private void PressCancelButton() { A.SetActive(false); B.SetActive(false); C.SetActive(false); sell_button.SetActive(false); upgrade_button.SetActive(false); selected_unit_image.enabled = false; selected_unit_name.enabled = false; selected_unit_stat.enabled = false; TowerControl.delete_SelectionList(TowerControl.selected, TowerControl.selected_circle); TurretRangeCircle.Delete_Range_Circle(); if (Tooltip.tooltip) { Tooltip.Destroy_tooltip(Tooltip.tooltip); } }