Number Wizard Random Interaction

    this makes the guess randomized and more interesting when you press the arrow keys!



if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        randomWords = Random.Range(1, 4);
        min = guess;
        guess = (max + min) / 2;
        if (randomWords == 1)
        {
            Debug.Log("Maybe it is..  " + guess + "?");
        }
        else if (randomWords == 2)
        {
            Debug.Log("What About " + guess + "?");
        }
        else if (randomWords == 3)
        {
            Debug.Log("Hmm.. Is it " + guess + "?");
        }
    }
    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        randomWords = Random.Range(1, 4);
        max = guess;
        guess = (max + min) / 2;
        if (randomWords == 1)
        {
            Debug.Log("Maybe it is..  " + guess + "?");
        }
        else if (randomWords == 2)
        {
            Debug.Log("What About " + guess + "?");
        }
        else if (randomWords == 3)
        {
            Debug.Log("Hmm.. Is it " + guess + "?");
        }
    }

Privacy & Terms