Added defect detector prefab.

This commit is contained in:
Khauvinkh
2024-08-17 21:07:25 +02:00
parent ece1afe008
commit ae76789a51
7 changed files with 534 additions and 2 deletions

View File

@@ -17,14 +17,14 @@ public class ProductDescription : ScriptableObject
public GameObject GetRandomProduct()
{
float randomValue = Random.value;
float randomValue = Random.Range(0, 100);
float sum = 0;
for (var i = 0; i < Products.Length; i++)
{
var product = Products[i];
sum += product.Probability / 100f;
sum += product.Probability;
if (randomValue <= sum)
{
return product.Prefab;