I am trying to solve the issue but I am not able to do that. My program is not terminating after number of guesses I asked to make. please help in this regard. below is the code.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class NumberWizard : MonoBehaviour {
// Use this for initialization
int max;
int min;
int guess;
public int MaxGuessAllow=5;
public Text text;
void Start () {
StartGame();
}
void StartGame () {
max = 1000;
min = 1;
guess = 500;
max = max + 1;
}
public void GuessHigher(){
min = guess;
NextGuess();
}
public void GuessLower(){
max = guess;
NextGuess();
}
public void NextGuess () {
guess = (max + min) / 2;
text.text = guess.ToString ();
MaxGuessAllow = MaxGuessAllow-1;
if (MaxGuessAllow <= 0) {
Application.LoadLevel("Win");
}
}
}