private void Buttons() { if (Input.GetMouseButtonDown(0)) { if (canInteract) { if (isOverUnit) { selected = hoverOver; gui.SetUnitInformation(selected); } else { if (gui.GetToolTipEnabled()) { selected = null; gui.HideUnitInformation(); } else { // Nothing, yet... } } } } if (Input.GetButtonDown("Build")) { gui.ActivateBuildMenu(); } }
private void ClickOn() { RaycastHit hit; Ray ray = kamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.transform.tag.Equals("Clickable")) { if (gui.GetToolTipEnabled()) { if (!isOverUnit) { isOverUnit = true; hoverOver = hit.transform.gameObject.GetComponentInParent<UnitMainScript>(); gui.ActivateToolTip(hoverOver.unitName); gui.ChangePointer("Unit"); } } else { isOverUnit = false; hoverOver = null; gui.DeActivateToolTip(); gui.ChangePointer("Normal"); } } else if (isOverUnit) { isOverUnit = false; hoverOver = null; gui.DeActivateToolTip(); gui.ChangePointer("Normal"); } } }
public void SetInfo(UnitMainScript u) { unitName.text = u.unitName; infoText.text = u.HentInfo(); }
public void Birth(string unitName, int health, float solidity, UnitMainScript father, UnitMainScript mother) { Create(unitName, health, UnitType.Person); this.father = father; this.mother = mother; }
IEnumerator InfoUpdate(UnitMainScript u) { while (infoDisplayGO.activeSelf) { infoDisplay.SetInfo(u); yield return new WaitForSeconds(1.0f); } }
public void SetUnitInformation(UnitMainScript u) { infoDisplayGO.SetActive(true); StopCoroutine("InfoUpdate"); StartCoroutine("InfoUpdate", u); }