Hey this is my game code. Thankx for this course.
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");
Debug.Log("Think a number :");
Debug.Log("The Highest number is " + max);
Debug.Log("The lowest number is " + min);
Debug.Log("Tell me is your number ih higter or lower than " + guess);
Debug.Log("Push Up = Higher, Push Down = Lower, Push Enter = Correct ");
max++;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("Your number is + or - of " + guess + " ?");
}
//Detect when the Return key is pressed down
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Hey Good job your number is : " + guess);
}
//Detect when the down arrow key is pressed down
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Your number is + or - of " + guess + " ?");
}
}
}