Hello from the UK, i want to play a game

public class NumberWizard : MonoBehaviour
{
int maximum = 1000;
int minimum = 1;
int guess = 500;

// Start is called before the first frame update
void Start()
{
    Debug.Log("Hello Stranger, I Want To Play A Game!");
    Debug.Log("I would like you to think of a number but don't tell me what it is.");
    Debug.Log("The highest number you can choose is: " + maximum);
    Debug.Log("And the lowest number you can choose is: " + minimum);
    Debug.Log("Now tell me if your number is higher or lower than " + guess);
    Debug.Log("Press Up arrow = Higher, Press Down arrow = Lower, Press Enter = Correct");
    maximum = maximum + 1;
}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        minimum = guess;
        guess = (maximum + minimum) / 2;
        Debug.Log("Is your number higher or lower than " + guess);
    }
    else if (Input.GetKeyDown(KeyCode.DownArrow))
    { 
        maximum = guess;
        guess = (maximum + minimum) / 2;
        Debug.Log("Is your number higher or lower than " + guess);
    }
    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("Are you impressed? have another go.");
    }
}

}

Privacy & Terms