public static BaseArmour generate(int round) { int ctr = 0; armour = new BaseArmour(); ctr++; pickArmourType(); switch (armour.Armour) { case (BaseArmour.ArmourTypes.HELMET): armour.Stamina = Random.Range(3, 6) + (int)(round * 0.5); armour.Initiative = Random.Range(1, 2) + (int)(round * 0.1); armour.ItemName = "+" + armour.Stamina.ToString(); break; case (BaseArmour.ArmourTypes.CHEST): armour.Strength = Random.Range(2, 4) + (int)(round * 0.25); armour.Stamina = Random.Range(6, 10) + (int)(round * 0.6); armour.ItemName = "+" + armour.Stamina + "/+" + armour.Strength; break; case (BaseArmour.ArmourTypes.BOOTS): armour.Stamina = Random.Range(1, 3) + (int)(round * 0.15); armour.Strength = Random.Range(2, 4) + (int)(round * 0.2); armour.ItemName = "+" + armour.Stamina + "/+" + armour.Strength; break; } return(armour); }
// Use this for initialization void Start() { round.text = " "; maxStamina = 40; currStamina = 40; strength = 3; initiative = 7; equip = new BaseArmour(); equip2 = new BaseArmour(); equip3 = new BaseArmour(); weap = new BaseWeapon(); pot1 = new BasePotion(); pot2 = new BasePotion(); pot3 = new BasePotion(); int ctr = 0; prefabList.Add(Prefab1); prefabList.Add(Prefab2); SpawnEnemy(); str.text = "Strength: " + strength.ToString(); potion1.text = "Potion1: " + pot1.ItemName; potion2.text = "Potion2: " + pot2.ItemName; potion3.text = "Potion3: " + pot3.ItemName; }
void Loot() { int temp = Random.Range(0, 3); if (temp == 0) { BaseArmour tempArmour = ArmourGenerator.generate(ctr); switch (tempArmour.Armour) { case (BaseArmour.ArmourTypes.HELMET): equip = tempArmour; break; case (BaseArmour.ArmourTypes.CHEST): equip2 = tempArmour; break; case (BaseArmour.ArmourTypes.BOOTS): equip3 = tempArmour; break; } Debug.Log("Armour drop"); } else if (temp == 1) { weap = WeaponGenerator.generate(ctr); Debug.Log("Weapon drop"); } else if (temp == 2) { BasePotion tempPot = PotionGenerator.generate(ctr); if (string.Compare(pot1.ItemName, "Empty") == 0) { pot1 = tempPot; } else if (string.Compare(pot2.ItemName, "Empty") == 0) { pot2 = tempPot; } else if (string.Compare(pot3.ItemName, "Empty") == 0) { pot3 = tempPot; } Debug.Log("Potion drop"); } int diffrence = maxStamina - currStamina; maxStamina = 40 + equip.Stamina + equip2.Stamina + equip3.Stamina + weap.Stamina; currStamina = 40 + equip.Stamina + equip2.Stamina + equip3.Stamina + weap.Stamina - diffrence; if (currStamina > maxStamina) { currStamina = maxStamina; } strength = 3 + equip.Strength + equip2.Strength + equip3.Strength + weap.Strength; initiative = 7 + equip.Initiative + equip2.Initiative + equip3.Initiative + weap.Initiative; weapon.text = "Weapon: " + weap.ItemName; arm1.text = "Helmet: " + equip.ItemName; arm2.text = "Chestplate: " + equip2.ItemName; arm3.text = "Boots: " + equip3.ItemName; potion1.text = "Potion1: " + pot1.ItemName; potion2.text = "Potion2: " + pot2.ItemName; potion3.text = "Potion3: " + pot3.ItemName; }