using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizardConsole : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Namaste, A fresh welcome in the game, Number Wizard ");
Debug.Log("Don't pick the number more than "+max);
Debug.Log("Also beware of choosing a number less than "+min);
Debug.Log("Here is some instructions for you :");
Debug.Log("1. If your number is greater than my guess press Up arrow key.");
Debug.Log("2. If your number is smaller than my guess press Down arrow key.");
Debug.Log("3. If I guessed you number correctly, press Enter.");
Debug.Log("Okay, Now tell me either your number is higher or lower than "+guess+", or my guess is correct ?");
max = max + 1;
}
// Update is called once per frame
void Update()
{
//Detect when the up arrow key is pressed down
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (min + max) / 2;
Debug.Log("Is your number is higher or lower than "+guess);
}
//Detect when the Down arrow key is pressed down
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (min + max) / 2;
Debug.Log("Is your number is higher or lower than "+guess);
}
//Detect when the Enter key is pressed down
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Hahaha !!! I won.");
}
}
}