I have a script that has a list of strings (words). When i inicialize the scene it will random choose one of the strings and remove it from the list.
There is a string variable that the player must fill with letteres to compose and make that string variable equal to the string from the list.Both must has the same length. Before that a variable word is composed with “-”.
the question is that every time a reaload scene with Application.LoadedLevel, the length of the variable it’s not the same as the string from the list.
here is the script:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class nova : MonoBehaviour {
public List<string> palavras = new List<string>();
public static string palavradalista;
public static string word;
void Start () {
escolherdalista ();
ja = false;
}
void escolherdalista(){
escolher = true;
int termoIndex = Random.Range (0, palavras.Count);//escolhe aleatoriamente um palavra da lista
palavradalista = palavras [termoIndex];
palavras.RemoveAt (termoIndex);//remove a palavra da lista para não voltar a repetir
segue ();//segue para o próximo passo
}
void segue(){
for (int i = 0; i < palavradalista.Length; i++)
word += "-";
}
Can anybody help please