public class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Use this for initialization
void Start ()
{
Debug.Log("Bom dia! I'm the Number Wizard!");
Debug.Log("Let's play a game. Choose a number and I'll try to find out what number it is!");
Debug.Log("Highest number is: " + max);
Debug.Log("Lowest number is: " + min);
Debug.Log("Let's Start! Is 500 your number ?");
Debug.Log("Push up = Higher, Push down = Lower, Push Enter = Correct.");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("Certo, am I closer now ?");
min = guess;
guess = (min + max) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Muito bem, Let's try again, now what do you think ?");
max = guess;
guess = (min + max) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Maravilhoso! That was great. Come back anytime!");
}
}
}