while (winner == “no”)
{
bool fighterPassed = false;
bool plotPassed = false;
if (Random.Range(0f, 10f) >= 5.5f)
{
Debug.Log("higher!");
winner = "CPU";
return winner;
}
else if (Random.Range(0f, 10f) < 5.5f)
{
Debug.Log("lower!");
winner = "Player";
return winner;
}
else if (Random.Range(0f, 10f) <= targetThrowFighter)
{
Debug.Log("how can this happen wtf");
fighterPassed = true;
return winner;
}
I don’t understand how the 3rd case can ever be triggered but it does quite frequently, about 20% of the time. Is there a way to see what Random.Range returned so I can see which values trigger the 3rd case? I’m sure I’m missing something obvious here.
edit: I changed it to
else
{
Debug.Log("how can this happen wtf");
fighterPassed = true;
return winner;
}
and behavior is the same / changes as expected, it goes up to 25-30% since it doesn’t have to pass the extra hurdle of <= targetThrowFighter