using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizard : MonoBehaviour {
int max = 1000;
int min = 1;
int guess = 500;
// Use this for initialization
void Start () {
Debug.Log("Welcome To Number Wizard");
Debug.Log("I'll guess the number in your mind");
Debug.Log("Pick A Random Number");
Debug.Log("Highest Number You Can Pick Is " +max);
Debug.Log("Lowest Number You Can Pick is " +min);
Debug.Log("Tell me if it's lower or higher than " +guess);
Debug.Log("Press Up = Its Higher, Press Down = It's Lower, Press Ener = Correct");
max = max + 1;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("Is it lower or higher than" +guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Is it lower or higher than" + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Bingo.");
}
}
}
1 Like