int max,min,guess;
// Start is called before the first frame update
void Start()
{
StartGame();
}
void StartGame()
{
max = 1000;
min = 1;
guess = 500;
Debug.Log("Benvenuto nel Mago dei numeri");
Debug.Log("Scegli un numero, non dirmi qual'e...");
Debug.Log($"Il numero piu alto che puoi scegliere e: {max}");
Debug.Log($"Il numero piu basso che puoi scegliere e: {min}");
Debug.Log($"Dimmi se il numero che hai pensato e piu alto o piu basso di {guess}");
Debug.Log("Freccia in alto se e piu alto, freccia in basso se e piu basso e invio se e corretto");
max++;
}
void NextGuess()
{
guess = (max + min) / 2;
Debug.Log($"Il numero e: {guess} ?");
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
NextGuess();
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
NextGuess();
}
else if(Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Te l'avevo detto che ero un mago!!");
StartGame();
}
}