Hi all, I wanted to display maxGuessesAllowed in another text box. I am stumped. I cant understand how I get another text box to display anything else from the nextGuess() function. A little help please would be incredibly helpful/
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class NumberWizard : MonoBehaviour {
int max;
int min;
int guess;
public int maxGuessesAllowed = 5;
public int TriesLeft; //>>?? Use this to display maxGuessesAllowed?
public Text text;
// Use this for initialization
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();
}
void NextGuess (){
guess = (max + min) / 2;
text.text = guess.ToString();
maxGuessesAllowed = maxGuessesAllowed - 1;
// I am guessing i need to put TriesLeft here somehow
if (maxGuessesAllowed <= 0) {
SceneManager.LoadScene ("Win");
}
}
}