I just realized that you are on the console version of Number Wizard, sorry!
In this case, in order to don’t work with multiple scripts and scenes, I think that the best way to do it would be to keep track if the player has already chosen the language that he wants within a bool and prevent the player from changing the language again, using if statements:
bool LanguageChosen = false;
int max;
int min;
int guess;
int lang = 0;
// Use this for initialization
void Start () {
StartGame();
}
void StartGame(){
print ("Choose the languange:");
print ("1 for English");
print ("2 para Português (BR)");
}
void StartGameEn(){
max = 1000;
min = 1;
guess = 500;
print ("!==========================!");
print ("Welcome to Number Wizard!");
print ("Pick a number in your head, but don't tell me.");
print ("The highest number you can pick is " + max);
print ("The lowest number you can pick is " + min);
print ("Is the number higher or lower than " + guess + "?");
print ("Press up for higher, down for lower and enter for equal");
max = max + 1;
}
void StartGamePtBr(){
max = 1000;
min = 1;
guess = 500;
print ("!==========================!");
print ("Bem Vindo(a) ao Number Wizard!");
print ("Pense em um número, mas não me conte ainda!");
print ("O maior número que você pode escolher é " + max);
print ("O menor número que você pode escolher é " + min);
print ("O número que você pensou é maior ou menor que " + guess + "?");
print ("Pressione cima para maior, baixo para menor ou enter para igual");
max = max + 1;
}
void NextGuess(){
guess = (max + min) /2;
if (lang == 1){
print ("Is the number higher or lower than " + guess + "?");
print ("Press up for higher, down for lower and enter for equal");
} else if (lang == 2){
print ("O número é maior ou menor que " + guess + "?");
print ("Pressione cima para maior, baixo para menor ou enter para igual");
}
}
void Update()
{
if (LanguageChosen == false){
if (Input.GetKeyDown(KeyCode.Alpha1)){
StartGameEn();
lang = 1;
LanguageChosen = true;
} else if (Input.GetKeyDown(KeyCode.Alpha2)){
StartGamePtBr();
lang = 2;
LanguageChosen = true;
}
}
else {
if (Input.GetKeyDown (KeyCode.UpArrow)) {
//Up key pressed
min = guess;
NextGuess ();
} else if (Input.GetKeyDown ("down")) {
//Down key pressed
max = guess;
NextGuess ();
} else if (Input.GetKeyDown ("return") && lang == 1) {
print ("I won!");
StartGameEn ();
} else if (Input.GetKeyDown ("return") && lang == 2) {
print ("Eu venci!");
StartGamePtBr ();
}
}
}
just tried it, seems to work as intended.
Let me know if I can be of further help.