예제 #1
0
    //显示士兵信息
    public void showUnitInformation(bool bShowInformation)
    {
        if (selectedUnit == null)
        {
            return;
        }

        if (bShowInformation == true)
        {
            SoldierType.Soldiers thisUnit = selectedUnit.m_pSoldier;
            int maxHP = thisUnit.getMaxHP();
            UIManager.Instance.maxHP.GetComponent <Text>().text = maxHP.ToString();
            int attack = thisUnit.getAttack();
            UIManager.Instance.attackValue.GetComponent <Text>().text = attack.ToString();
            int maxStep = thisUnit.getMaxMoveStep();
            UIManager.Instance.maxMoveStep.GetComponent <Text>().text     = maxStep.ToString();
            UIManager.Instance.soldierTypeName.GetComponent <Text>().text = thisUnit.returnTypeName();
            int currentHP = thisUnit.getCurrentHP();
            UIManager.Instance.currentHP.GetComponent <Text>().text = currentHP.ToString();
            int currentMoveStep = thisUnit.getCurrentMoveStep();
            UIManager.Instance.currentMoveStep.GetComponent <Text>().text = currentMoveStep.ToString();
            UIManager.Instance.soldierTypeImage.sprite = UIManager.Instance.unitSprites[thisUnit.returnSpriteIndex()];
        }
        else
        {
            UIManager.Instance.maxHP.GetComponent <Text>().text           = null;
            UIManager.Instance.attackValue.GetComponent <Text>().text     = null;
            UIManager.Instance.maxMoveStep.GetComponent <Text>().text     = null;
            UIManager.Instance.soldierTypeName.GetComponent <Text>().text = null;
            UIManager.Instance.soldierTypeImage.sprite = UIManager.Instance.noSprite;
            UIManager.Instance.currentMoveStep.GetComponent <Text>().text = null;
            UIManager.Instance.currentHP.GetComponent <Text>().text       = null;
        }
    }