Пример #1
0
    public WeaponTemplate getTemplateforType(WeaponInfo.weaponTypes newWeaponType)
    {
        foreach (WeaponTemplate w in WeaponTemplates)
        {
            if (w.weaponType == newWeaponType)
            {
                return(w);
            }
        }

        return(null);
    }
Пример #2
0
    WeaponInfo getItemforRecipe(ContentType.contentItem ingredient, int ingredientCount)
    {
        //2 metals = dagger
        //3 metals = sword
        //4 metals = greatsword

        gameControl = GameObject.Find("GameControl");

        int damageMultiplier = 1;

        if (ingredient == ContentType.contentItem.copper_ingot || ingredient == ContentType.contentItem.iron_ingot)
        {
            if (ingredient == ContentType.contentItem.copper_ingot)
            {
                damageMultiplier = 1;
            }

            if (ingredient == ContentType.contentItem.iron_ingot)
            {
                damageMultiplier = 2;
            }

            WeaponInfo.weaponTypes newWeaponType = WeaponInfo.weaponTypes.none;
            switch (ingredientCount)
            {
            case 2:
                newWeaponType = WeaponInfo.weaponTypes.Dagger;
                break;

            case 3:
                newWeaponType = WeaponInfo.weaponTypes.LongSword;
                break;

            case 4:
                newWeaponType = WeaponInfo.weaponTypes.GreatSword;
                break;
            }

            WeaponTemplate template = gameControl.GetComponent <CraftingManager> ().getTemplateforType(newWeaponType);

            return(new WeaponInfo(template, damageMultiplier));
        }
        return(null);
        //2 berries = weak hp potion
        //3 berries = med hp potion
        //4 berries = strong hp potion

        //2 wood = short bow
        //3 wood = recurve box
        //4 wood = longbox
    }