Welcome to the Number Wizard's Igloo, eh?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NumberWizard : MonoBehaviour
{
int maxNumber = 1000;
int minNumber = 1;
int guess = 500;

// Start is called before the first frame update
void Start()
{

    Debug.Log("Welcome to the Number Wizard's Igloo, eh?");
    Debug.Log("Please pick a number in order to enter my lair. Then I shall grant you refuge from the snowstorm!");
    Debug.Log("The highest number you may pick is: " + maxNumber);
    Debug.Log("The lowest number you may pick is: " + minNumber);
    Debug.Log("Tell me if your number is higher or lower than: " + guess);
    Debug.Log("Push Up = Higher, Push Down = Lower, Press Enter = Correct");
    maxNumber = maxNumber + 1;
}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        Debug.Log("Is your number higher or lower than ");
        minNumber = guess;
        guess = (maxNumber + minNumber) / 2;
        Debug.Log(guess + "?");
    }
    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        Debug.Log("Is your number higher or lower than ");
        maxNumber = guess;
        guess = (maxNumber + minNumber) / 2;
        Debug.Log(guess + "?");
    }
    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("Thank you for playing with me.");
        Debug.Log("Your number was: " + guess + "!");
        Debug.Log("Please come in for donairs, cocoa and maple chocolate.");
    }
}

}

Privacy & Terms