Example #1
0
    public static Weapons CreateWeaponBySize(WeaponsSize size, int lvl)
    {
        WeaponsDamageCat[] catlist = System.Enum.GetValues(typeof(WeaponsDamageCat)) as WeaponsDamageCat[];
        WeaponsDamageCat   cat     = catlist[UnityEngine.Random.Range(0, System.Enum.GetNames(typeof(WeaponsDamageCat)).Length)];
        //Debug.Log(cat);
        WeaponsBase wep = WeaponsList[cat][size].Keys.ElementAt((int)UnityEngine.Random.Range(0, WeaponsList[cat][size].Count - 1));

        return(new Weapons(wep, lvl));
    }
Example #2
0
    private void getWeaponProp(WeaponsBase baseWep)
    {
        foreach (KeyValuePair <WeaponsDamageCat, Dictionary <WeaponsSize, Dictionary <WeaponsBase, Power> > > cat in WeaponsList)
        {
            foreach (KeyValuePair <WeaponsSize, Dictionary <WeaponsBase, Power> > size in cat.Value)
            {
                foreach (KeyValuePair <WeaponsBase, Power> weapon in size.Value)
                {
                    if (weapon.Key == baseWep)
                    {
                        this.category = cat.Key;
                        //	Debug.Log(cat.Key);
                        this.size = size.Key;

                        float.TryParse(WeaponsSkills[this.category]["range"], out this.range);
                        //	Debug.Log(size.Key);
                    }
                }
            }
        }
        for (int x = 0; x < Enum.GetNames(typeof(Attributes)).Length; x++)
        {
            if (WeaponsSkills[this.category]["attackAttr"] == Enum.GetName(typeof(Attributes), x))
            {
                this.attackAttr = (Attributes)x;
            }
        }
        for (int x = 0; x < Enum.GetNames(typeof(Attributes)).Length; x++)
        {
            if (WeaponsSkills[this.category]["damageAttr"] == Enum.GetName(typeof(Attributes), x))
            {
                this.attackAttr = (Attributes)x;
            }
        }
        for (int x = 0; x < Enum.GetNames(typeof(Skills)).Length; x++)
        {
            if (WeaponsSkills[this.category]["attackSkill"] == Enum.GetName(typeof(Skills), x))
            {
                this.attackSkill = (Skills)x;
            }
        }
        //this.attackSkill = WeaponsSkills[this.category]["attackSkill"];
        //Debug.Log(this.attackSkill);
        //this.attackAttr = WeaponsSkills[this.category]["attackAttr"];
        //Debug.Log(this.attackAttr);
        //this.damageAttr = WeaponsSkills[this.category]["damageAttr"];
        //Debug.Log(this.damageAttr);
    }