I made a win condition

And it works!

The varibles
public float guessleft = 10f;
bool win = false;

The guessleft counter

void subtractguess()
{
guessleft = guessleft - 1;
Debug.Log(guessleft);
}

Deciding whether or not the wizard has been outwitted

public void GameWon()
{
    if (guessleft > 0)
    {
        return; 
    }
    if (guessleft < 1)
    {
        win = true;
    }

    

    if (win == false)
    {
        return;
    }
    else if(win == true)
    {
        SceneManager.LoadScene(3);
    }
}

Took me 1 and half hours to figure out through trial and error, but I did it. The wizard has 20 guesses to guess your number from 1-10000. I don’t know if it is the prefered method, but hey baby steps.

Privacy & Terms