Hi all,
Here is my Number Wizard Greeting:
Also Aussie but not that Aussie
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Welcome to Number Wizard mate!");
Debug.Log("Pick a number, but don't tell me what it is...");
Debug.Log("The highest number you can choose is: " + max);
Debug.Log("The lowest number you can choose is: " + min);
Debug.Log("Tell me if your number is 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()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("You said it's higher, hmm...");
min = guess;
guess = (max + min) / 2;
Debug.Log("So is it: " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("You said it's lower, hmm...");
max = guess;
guess = (max + min) / 2;
Debug.Log("So is it: " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Ha, so it was: " + guess);
}
}
}