i complete this code before the lessons finish:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class number : MonoBehaviour
{
int max = 10001;
int min = 1;
int guess;
int count = 0;
// Start is called before the first frame update
void Start()
{
again();
}
// Update is called once per frame
void Update()
{
if (count < 7)
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guessess();
myname();
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Down arrow was pressed!");
max = guess;
guessess();
myname();
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("I win");
again();
}
}
else
{
Debug.Log("I Lose");
count = 0;
again();
}
}
void guessess()
{
guess = Random.Range(min , max);
count += 1;
}
void again()
{
max = 10001;
min = 1;
guess = Random.Range(min , (max));
Debug.Log("Welcome to Number Wizard!");
Debug.Log("Pick a number!");
Debug.Log("Your number must be from " + min + " to " + (max - 1) );
myname();
}
void myname()
{
Debug.Log("you number is higher or lower or equals the " + guess);
Debug.Log("UpArrow = higher & DownArrow = lower & Enter = Correct");
}
}