private void spawn(weaponSpawn w) { float r = Random.Range(0f, 1f); if (r < WeaponVsConsumable) { spawnWeapon(w); } else { //spawnWeapon(w); spawnConsumable(w); } }
private void spawnConsumable(weaponSpawn w) { Transform wTransform = w.transform; float r = Random.Range(0f, 1f); if (r < commonProbability) { int s = Random.Range(0, commonConsumable.Length); w.setMyWeapon((Transform)Instantiate((Transform)commonConsumable[s], wTransform.position, wTransform.rotation)); // creating first weapon } else if (r < commonProbability + uncommonProbability) { int s = Random.Range(0, uncommonConsumable.Length); w.setMyWeapon((Transform)Instantiate((Transform)uncommonConsumable[s], wTransform.position, wTransform.rotation)); // creating first weapon } else if (r < commonProbability + uncommonProbability + rareProbability) { int s = Random.Range(0, rareConsumable.Length); w.setMyWeapon((Transform)Instantiate((Transform)rareConsumable[s], wTransform.position, wTransform.rotation)); // creating first weapon } else { spawnConsumable(w); } }