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);
        }
    }
Ejemplo n.º 2
0
    private BaseItem CreateLoot(Quest quest)
    {
        BaseWeapon rewardItem;
        int        rewardValue = Random.Range(1, 3) * quest.GetDifficulty();

        switch (Random.Range(0, 6))
        {
        case 0:
            rewardItem = new Weapon_Sword();
            rewardItem.SetBaseScore(rewardValue);
            break;

        case 1:
            rewardItem = new Weapon_Sword();
            rewardItem.SetBaseScore(rewardValue);
            break;

        case 2:
            rewardItem = new Weapon_Axe();
            rewardItem.SetBaseScore(rewardValue);
            break;

        case 3:
            rewardItem = new Weapon_Polearm();
            rewardItem.SetBaseScore(rewardValue);
            break;

        case 4:
            rewardItem = new Weapon_Bow();
            rewardItem.SetBaseScore(rewardValue);
            break;

        case 5:
            rewardItem = new Weapon_Longsword();
            rewardItem.SetBaseScore(rewardValue);
            break;

        case 6:
            rewardItem = new Item_Shield();
            rewardItem.SetBaseScore(rewardValue);
            break;

        default:
            rewardItem = new Weapon_Sword();
            rewardItem.SetBaseScore(rewardValue);
            break;
        }

        Debug.Log("Quest Reward Made");

        return(rewardItem);
    }