using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizard : MonoBehaviour
{
// variables
int max = 1000;
int min = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{ //Starting dialogue
Debug.Log("Greetings i am Merlin the wizard...Welcome to my number wizard");
Debug.Log("Please pick any number and i shall find tell what it is...dont be scared!!!");
Debug.Log("The highest the number you can pick is: " + max);
Debug.Log("The lowest the number you can pick is: " + min);
Debug.Log("Tell me if your number higher or lower than: " + guess);
Debug.Log("Push Up = Higher, Push Down = Lower, Enter = 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)) //is pressed if their number is higher than the current guess
{
min = guess;
guess = (max + min) / 2;
Debug.Log("So is your numbner higher or lower than : " + guess);
}
//Detect when the Up key is pressed down
else if (Input.GetKeyDown(KeyCode.DownArrow)) // is pressed if their number is lower than the current guess
{
max = guess;
guess = (max + min) / 2;
Debug.Log("So is your numbner higher or lower than : " + guess);
}
//Detect when the Return key is pressed down
else if (Input.GetKeyDown(KeyCode.Return)) // is pressed if the guess was correct.
{
Debug.Log("I told i am wizard...this is nothing to me!!!!! ");
}
}
}
