示例#1
0
        public string GenerateName(WeaponQuality quality, WeaponType type)
        {
            var sb = new StringBuilder();

            sb.Append(quality.ToString());
            sb.Append(" ");
            sb.Append(type.ToString());
            sb.Append(" ");
            sb.Append("of Testing");
            return(sb.ToString());
        }
示例#2
0
    public static Weapon CreateWeapon(WeaponType type, WeaponQuality quality = WeaponQuality.Factory)
    {
        var weapon = new Weapon()
        {
            Guid    = Guid.NewGuid(),
            Type    = type,
            Quality = quality
        };

        var values = Enum.GetValues(typeof(WeaponType)).Cast <int>();
        var index  = Enum.GetNames(typeof(WeaponType)).ToList().IndexOf(type.ToString()); // ugh

        var price = values.ElementAt(index);

        values = Enum.GetValues(typeof(WeaponQuality)).Cast <int>();
        index  = Enum.GetNames(typeof(WeaponQuality)).ToList().IndexOf(quality.ToString()); // ugh

        price *= values.ElementAt(index);

        weapon.Price = price;
        weapon.Name  = type.ToString();

        return(weapon);
    }
示例#3
0
    public static Weapon CreateWeapon(WeaponType type, WeaponQuality quality = WeaponQuality.Factory)
    {
        var weapon = new Weapon()
        {
            Guid = Guid.NewGuid(),
            Type = type,
            Quality = quality
        };

        var values = Enum.GetValues(typeof(WeaponType)).Cast<int>();
        var index = Enum.GetNames(typeof(WeaponType)).ToList().IndexOf(type.ToString()); // ugh

        var price = values.ElementAt(index);

        values = Enum.GetValues(typeof(WeaponQuality)).Cast<int>();
        index = Enum.GetNames(typeof(WeaponQuality)).ToList().IndexOf(quality.ToString()); // ugh

        price *= values.ElementAt(index);

        weapon.Price = price;
        weapon.Name = type.ToString();

        return weapon;
    }