Пример #1
0
    void Show_UpgradePanel()
    {
        if (selected != null)
        {
            Upgrade_Set();
            RecipePanel.CraftPanel.SetActive(true);
            SlotItem item = new SlotItem(selected, 1);
            CreateInfoWindow(item);

            switch (selected.Category)
            {
            case ItemCategory.Armor:
                IArmor armor = new IArmor((IArmor)selected);
                armor.UpgradeItem(armor.Stage + 1);
                item = new SlotItem(armor, 1);
                CreateInfoWindow(item);
                break;

            case ItemCategory.Weapon:
                IWeapon W_selected = (IWeapon)selected;
                IWeapon weapon     = new IWeapon(W_selected);
                weapon.UpgradeItem(weapon.Stage + 1);
                item = new SlotItem(weapon, 1);
                CreateInfoWindow(item);
                break;
            }
        }
        StartCoroutine(CooldownSpawn());
    }
Пример #2
0
    public void Improve_Item()
    {
        List <IComponent> ListComponents = null;

        switch (selected.Category)
        {
        case ItemCategory.Armor:
            IArmor armor = (IArmor)selected;
            ListComponents = StaticValues.UpgradesItems.Armors[(int)armor.ACategory].Weight_Type[(int)armor.Weight].Stage[armor.Stage].Components;
            break;

        case ItemCategory.Weapon:
            IWeapon weapon = (IWeapon)selected;
            ListComponents = StaticValues.UpgradesItems.Weapons[(int)weapon.WCategory].Stage[weapon.Stage].Components;
            break;
        }
        for (int i = 0; i < ListComponents.Count; i++)
        {
            StaticValues.InvMagazine.RemoveItem(SetItem(ListComponents[i]), ListComponents[i].amount);
        }
        switch (selected.Category)
        {
        case ItemCategory.Armor:
            IArmor armor = new IArmor((IArmor)selected);
            armor.UpgradeItem(armor.Stage + 1);
            StaticValues.InvMagazine.RemoveItem(selected, 1);
            StaticValues.InvMagazine.AddItem(armor, 1);
            if (armor.Stage < StaticValues.UpgradesItems.MaxStage)
            {
                selected = armor;
            }
            else
            {
                selected = null;
            }
            selected = armor;
            break;

        case ItemCategory.Weapon:
            IWeapon W_selected = (IWeapon)selected;
            IWeapon weapon     = new IWeapon(W_selected);
            weapon.UpgradeItem(weapon.Stage + 1);
            StaticValues.InvMagazine.RemoveItem(selected, 1);
            StaticValues.InvMagazine.AddItem(weapon, 1);
            if (weapon.Stage < StaticValues.UpgradesItems.MaxStage)
            {
                selected = weapon;
            }
            else
            {
                selected = null;
            }
            break;
        }
        GetItemsFromMagazine();
        SpawnSlots();
        if (selected != null)
        {
            SetSelet(selected);
        }
        else
        {
            Close_RecipePanel();
        }

        StaticValues.WorkshopPoints.Blacksmith[0] = 1440;
        GetComponentInParent <WorkshopPanel>().PA_Spawn();
    }