示例#1
0
    public static void ShowUnitInfoPanel(bool canPlay = true)
    {
        unitInfoPanel.SetActive(false); //to trigger animation

        if (selectedUnit.tag == "NPC")
        {
            unitInfoPanel.transform.Find("UnitNamePanel").GetComponent <Image>().color = new Color32(0x9A, 0x00, 0x0A, 0xFF);
        }
        else
        {
            unitInfoPanel.transform.Find("UnitNamePanel").GetComponent <Image>().color = new Color32(0x34, 0x5E, 0xC0, 0xFF);
        }

        unitInfoPanel.transform.Find("UnitNamePanel").transform.Find("UnitName").GetComponent <Text>().text = selectedUnit.name;
        unitInfoPanel.transform.Find("UnitHPInfo").GetComponent <Text>().text          = selectedUnit.GetHP();
        unitInfoPanel.transform.Find("UnitLvlInfo").GetComponent <Text>().text         = selectedUnit.GetLvl();
        unitInfoPanel.transform.Find("UnitMoveRangeInfo").GetComponent <Text>().text   = selectedUnit.GetMovingRange();
        unitInfoPanel.transform.Find("UnitAttackRangeInfo").GetComponent <Text>().text = selectedUnit.GetAttackRange();

        GameObject unitTurnInfo = unitInfoPanel.transform.Find("UnitNamePanel").transform.Find("UnitTurnInfo").gameObject;

        if (!canPlay)
        {
            unitTurnInfo.SetActive(true);
        }
        else
        {
            unitTurnInfo.SetActive(false);
        }

        unitInfoPanel.SetActive(true); //if wanting to show unitInfoPanel but not actionPanel
    }