Beispiel #1
0
    void refreshEquipmentPanel()
    {
        Unit unitToShow = battleManager.getActiveUnit();

        refreshUnitDisplay(unitToShow);

        if (unitToShow.getHelmet() != null)
        {
            helmetImage.sprite = unitToShow.getHelmet().getSprite();
            helmetImage.color  = new Color(1f, 1f, 1f, 1f);
        }
        else
        {
            helmetImage.color = new Color(1f, 1f, 1f, 0f);
        }

        if (unitToShow.getArmor() != null)
        {
            armorImage.sprite = unitToShow.getArmor().getSprite();
            armorImage.color  = new Color(1f, 1f, 1f, 1f);
        }
        else
        {
            armorImage.color = new Color(1f, 1f, 1f, 0f);
        }

        if (unitToShow.getAccessory() != null)
        {
            //accessoryImage.sprite = unitToShow.getHelmet().getSprite(); TO DO
            accessoryImage.color = new Color(1f, 1f, 1f, 1f);
        }
        else
        {
            accessoryImage.color = new Color(1f, 1f, 1f, 0f);
        }

        if (unitToShow.getWeapon() != null)
        {
            weaponImage.sprite = unitToShow.getWeapon().getSprite();
            weaponImage.color  = new Color(1f, 1f, 1f, 1f);
        }
        else
        {
            weaponImage.color = new Color(1f, 1f, 1f, 0f);
        }

        if (unitToShow.getWeapon().getIsTwoHanded())
        {
            shieldImage.sprite = unitToShow.getWeapon().getSprite();
            shieldImage.color  = new Color(0.5f, 0.5f, 0.5f, 0.8f);
        }
        else if (unitToShow.getShield() != null)
        {
            shieldImage.sprite = unitToShow.getShield().getSprite();
            shieldImage.color  = new Color(1f, 1f, 1f, 1f);
        }
        else
        {
            shieldImage.color = new Color(1f, 1f, 1f, 0f);
        }

        if (unitToShow.getUtility() != null)
        {
            utilityImage.sprite = unitToShow.getUtility().getSprite();
            utilityImage.color  = new Color(1f, 1f, 1f, 1f);
        }
        else
        {
            utilityImage.color = new Color(1f, 1f, 1f, 0f);
        }

        unitName.text       = unitToShow.getName();
        unitRace.text       = unitToShow.getRace().name;
        unitHP.text         = unitToShow.getHeath("CURRENT") + "/" + unitToShow.getHeath("MAX");
        unitInitiative.text = unitToShow.getInitiative().ToString();

        if (unitToShow.getStatModifier("CON") >= 0)
        {
            unitCondition.text = "CON: " + unitToShow.getStat("CON") + " +" + unitToShow.getStatModifier("CON");
        }
        else
        {
            unitCondition.text = "CON: " + unitToShow.getStat("CON") + " " + unitToShow.getStatModifier("CON");
        }

        inspectedName.text = "";
        inspectedImage.gameObject.SetActive(false);
    }
 public void updateDisplay()
 {
     displayedName.text = battleManager.getActiveUnit().getName();
     actionRunesUpdate();
 }