예제 #1
0
    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();
        }
    }
예제 #2
0
    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");
            }
        }
    }
예제 #3
0
 public void SetInfo(UnitMainScript u)
 {
     unitName.text = u.unitName;
     infoText.text = u.HentInfo();
 }
예제 #4
0
 public void Birth(string unitName, int health, float solidity, UnitMainScript father, UnitMainScript mother)
 {
     Create(unitName, health, UnitType.Person);
     this.father = father;
     this.mother = mother;
 }
예제 #5
0
 IEnumerator InfoUpdate(UnitMainScript u)
 {
     while (infoDisplayGO.activeSelf)
     {
         infoDisplay.SetInfo(u);
         yield return new WaitForSeconds(1.0f);
     }
 }
예제 #6
0
 public void SetUnitInformation(UnitMainScript u)
 {
     infoDisplayGO.SetActive(true);
     StopCoroutine("InfoUpdate");
     StartCoroutine("InfoUpdate", u);
 }