Here is my code. Nothing special as it is still early days, but I am finding the course great so far.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberController : MonoBehaviour
{
int maximum = 1000;
int minimum = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Goodmorning Dave, Would you like to play a game?");
Debug.Log("The highest number you can pick is " + maximum);
Debug.Log("The lowest number you can pick is " + minimum);
Debug.Log("Tell me if your number is higher or lower than " + guess);
Debug.Log("Push Up = Higher, Push Down = Lower, Push Enter = Correct");
maximum = maximum + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
minimum = guess;
guess = (maximum + minimum) / 2;
Debug.Log("Is it higher or lower than..." + guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
maximum = guess;
guess = (maximum + minimum) / 2;
Debug.Log("Is it higher or lower than..." + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Enter was pressed. Yay!");
}
}
}