Ejemplo n.º 1
0
    public void Load(InventoryData inventoryData)
    {
        foreach (WeaponData weapon in inventoryData.weaponDataList)
        {
            BaseWeapon newWeapon;

            switch (weapon.weaponType)
            {
            case 0:
                newWeapon = new Weapon_Sword();
                break;

            case 1:
                newWeapon = new Weapon_Fists();
                break;

            case 2:
                newWeapon = new Weapon_Axe();
                break;

            case 3:
                newWeapon = new Weapon_Polearm();
                break;

            case 4:
                newWeapon = new Weapon_Bow();
                break;

            case 5:
                newWeapon = new Weapon_Longsword();
                break;

            case 6:
                newWeapon = new Item_Shield();
                break;

            default:
                newWeapon = new Weapon_Fists();
                break;
            }
            newWeapon.Load(weapon);

            AddItem(newWeapon);
        }

        foreach (ArmorData armor in inventoryData.armorDataList)
        {
            BaseArmor newArmor = new BaseArmor();
            newArmor.Load(armor);

            AddItem(newArmor);
        }
    }