Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NumWiz_UI_2 : MonoBehaviour
- {
- int max = 1000;
- int min = 1;
- int guess = 500;
- public void NextGuess()
- {
- guess = (min + max) / 2;
- Debug.Log(guess);
- }
- // Start is called before the first frame update
- void Start()
- {
- Debug.Log("Welcome to Number Wizard");
- Debug.Log("Pick a number from 1-1000");
- Debug.Log("Don't tell me your number because I can't hear you and you can't hear me, plus your probably crazy");
- Debug.Log("Oh and before I forget here are the controls:");
- Debug.Log("up arrow means the number is higher, down arrow means the Number is lower, and enter means that I got it right");
- Debug.Log("Is your number 500");
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.UpArrow))
- {
- Debug.Log("Up arrow was pressed");
- //changed!!
- min = guess;
- //old guess = min;
- NextGuess();
- }
- else if (Input.GetKeyDown(KeyCode.DownArrow))
- {
- Debug.Log("Down arrow key was pressed");
- //changed!!
- max = guess;
- //old guess = max;
- NextGuess();
- }
- else if (Input.GetKeyDown(KeyCode.Return))
- {
- Debug.Log("Yeah I got it right :)");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement