public static Boots CreateRandomBoots() { Boots boots = new Boots(); boots.MoveSpeed = RandomR.Rand.Next(GameManager.Round) + 3; boots.GoldCost = (int)((RandomR.Rand.Next((int)boots.MoveSpeed * 3) * 5) + GameManager.Round * boots.MoveSpeed); boots.SpriteName = "0" + (RandomR.Rand.Next(4) + 9).ToString("D2"); return(boots); }
public static Item CreateRandomItem() { Item item = new Item(); SpriteRenderer spriteRend = item.AddComponent <SpriteRenderer>(); switch (RandomR.Rand.Next(4)) { // Weapon case 0: item.TheWeapon = Weapon.WeaponPrefabs((Weapons)RandomR.Rand.Next(sizeof(Weapons))); item.Name = item.TheWeapon.Name; spriteRend.Sprite = Game1.LoadedImages[item.TheWeapon.SpriteName]; item.ItemType = ItemTypes.Weapon; item.GoldCost = item.TheWeapon.GoldCost; item.Spawn(); return(item); // Armor case 1: item.TheArmor = Armor.CreateRandomArmor(); spriteRend.Sprite = Game1.LoadedImages[item.TheArmor.SpriteName]; item.ItemType = ItemTypes.Armor; item.GoldCost = item.TheArmor.GoldCost; item.Spawn(); return(item); // Boots case 2: item.TheBoots = Boots.CreateRandomBoots(); spriteRend.Sprite = Game1.LoadedImages[item.TheBoots.SpriteName]; item.ItemType = ItemTypes.Boots; item.GoldCost = item.TheBoots.GoldCost; item.Spawn(); return(item); // Enemies case 3: item.MoreEnemies = RandomR.Rand.Next(6) + 1; spriteRend.Sprite = Game1.LoadedImages["01" + (item.MoreEnemies < 3 ? "3" : item.MoreEnemies < 5 ? "4" : "5")]; item.ItemType = ItemTypes.Enemy; item.GoldCost = (int)((RandomR.Rand.Next((int)item.MoreEnemies * 4) * 5) + GameManager.Round * item.MoreEnemies * 2) * 3; item.Spawn(); return(item); default: return(null); } }