public void over() { GameAction.TEXT_SOAL = "PERMAINAN BERAKHIR.."; Txt_SCORES.text = "Nilai : " + GameAction.SCORES.ToString(); PLAYERs.SetActive(false); PANEL_OVER.SetActive(true); PANEL_PLAY.SetActive(false); }
// Start is called before the first frame update void Start() { // Vector3 newPos = PLAYER_SPAWNER.transform.position; // Instantiate (PLAT_BASE,newPos, transform.rotation); PLAYERs.SetActive(true); PANEL_OVER.SetActive(false); PANEL_PLAY.SetActive(true); string[] listSoal = GameAction.LIRIK_LAGU[GameAction.INDEX_PILIHAN]; List <List <string> > ListSOAL_VALID = new List <List <string> >(); ARRAY_KATA = new List <string>(); foreach (string s in listSoal) { string[] strLirik = s.Split(' '); List <string> arrLirik = new List <string>(); foreach (string sas in strLirik) { string sa = sas.ToLower(); sa = UppercaseWords(sa); if (!arrLirik.Contains(sa)) { arrLirik.Add(sa); } if (!ARRAY_KATA.Contains(sa)) { ARRAY_KATA.Add(sa); } } if (arrLirik.Count > GameAction.ITEM_LEVEL[GameAction.GAME_LEVEL]) { ListSOAL_VALID.Add(arrLirik); } } int i = Random.Range(0, ListSOAL_VALID.Count); while (ListSOAL_VALID.Count < GameAction.JML_SOAL[GameAction.GAME_LEVEL]) { ListSOAL_VALID.Add(ListSOAL_VALID[i]); i = Random.Range(0, ListSOAL_VALID.Count); } ARRAY_LIRIK_SOAL = new List <string> [GameAction.JML_SOAL[GameAction.GAME_LEVEL]]; List <string>[] arrSoal = new List <string> [ListSOAL_VALID.Count]; i = 0; int[] indexSoal = new int[ListSOAL_VALID.Count]; foreach (List <string> lst in ListSOAL_VALID) { //Debug.Log(string.Join(", ", lst.ToArray())); arrSoal[i] = lst; indexSoal[i] = i; i++; } printArray(indexSoal); indexSoal = Shuffle(indexSoal); printArray(indexSoal); for (i = 0; i < ARRAY_LIRIK_SOAL.Length; i++) { ARRAY_LIRIK_SOAL[i] = ListSOAL_VALID[indexSoal[i]]; } foreach (List <string> lst in ARRAY_LIRIK_SOAL) { Debug.Log(string.Join(", ", lst.ToArray())); } GameAction.TRY_COUNT = 0; showSoal(); }