Beispiel #1
0
    public void RefreshEquipmentUI(Equipment equipment, int armor, int damage)
    {
        Color color = Color.HSVToRGB(0, 0, 0.56f);

        color.a = 0.36f;

        ArmorText.text  = $"arm: {armor}";
        DamageText.text = $"dmg: {damage}";

        UIHelmet.SetItem(equipment[EquipableItem.EquipementType.Helmet]);
        if (equipment[EquipableItem.EquipementType.Helmet] == null)
        {
            UIHelmet.GetItemImage().sprite = Resources.Load <Sprite>("ItemSprites/helmets");
            UIHelmet.GetItemImage().color  = color;
        }
        else
        {
            UIHelmet.GetItemImage().sprite = equipment[EquipableItem.EquipementType.Helmet].sprite;
            UIHelmet.GetItemImage().color  = Color.white;
        }

        UIChestplate.SetItem(equipment[EquipableItem.EquipementType.Chestplate]);
        if (equipment[EquipableItem.EquipementType.Chestplate] == null)
        {
            UIChestplate.GetItemImage().sprite = Resources.Load <Sprite>("ItemSprites/armor");
            UIChestplate.GetItemImage().color  = color;
        }
        else
        {
            UIChestplate.GetItemImage().sprite = equipment[EquipableItem.EquipementType.Chestplate].sprite;
            UIChestplate.GetItemImage().color  = Color.white;
        }

        UIBoots.SetItem(equipment[EquipableItem.EquipementType.Boots]);
        if (equipment[EquipableItem.EquipementType.Boots] == null)
        {
            UIBoots.GetItemImage().sprite = Resources.Load <Sprite>("ItemSprites/boots");
            UIBoots.GetItemImage().color  = color;
        }
        else
        {
            UIBoots.GetItemImage().sprite = equipment[EquipableItem.EquipementType.Boots].sprite;
            UIBoots.GetItemImage().color  = Color.white;
        }

        UIWeapon.SetItem(equipment[EquipableItem.EquipementType.Weapon]);
        if (equipment[EquipableItem.EquipementType.Weapon] == null)
        {
            UIWeapon.GetItemImage().sprite = Resources.Load <Sprite>("ItemSprites/sword");
            UIWeapon.GetItemImage().color  = color;
        }
        else
        {
            UIWeapon.GetItemImage().sprite = equipment[EquipableItem.EquipementType.Weapon].sprite;
            UIWeapon.GetItemImage().color  = Color.white;
        }
    }