예제 #1
0
    public void SelectNewUnit(GameObject unit)
    {
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Tile"))
        {
            go.GetComponent<tileInfo>().ChangeColorBack();
        }
        CityOrUnit = "Unit";
        if (selectedUnit != null)
        {
        selectedUnit.GetComponent<Renderer>().material.color = Color.gray;

        }
        selectedUnit = unit;
        text = GameObject.Find("MaxHpText").GetComponent<Text>();
        selectedUnit.GetComponent<Renderer>().material.color = Color.red;
        unitinfo = unit.GetComponent<unitInfo>();
        UpdateInformation();
    }
예제 #2
0
 // Use this for initialization
 public void init()
 {
     unitPanel      = GameObject.Find("Canvas/unitInfo");
     unitInfoScript = unitPanel.GetComponent <unitInfo>();
     unitPanel.SetActive(false);
 }