public bool charLeveled(Characters ch) { int exp = ch.getExp(); exp += dungeonExp; return(checkLevel(exp) > ch.getLevel()); }
IEnumerator run() { int mean = 0; GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); string[] charList = new string [players.Length]; for (int i = 0; i < players.Length; i++) { charList[i] = players[i].GetComponent <PlayerMovement>().charName; } chList = new Characters[charList.Length]; for (int i = 0; i < charList.Length; i++) { DoDebug(charList [i]); yield return(StartCoroutine(loadChar(charList[i]))); chList [i] = ch; mean += ch.getLevel(); DoDebug("--------------------"); } mean /= chList.Length; DoDebug("mean: " + mean); mean = 1; yield return(StartCoroutine(getMonList(mean))); DoDebug("monlist: " + monList); string[] mList = monList.Split(';'); monsterList = new Monster[mList.Length]; for (int i = 0; i < mList.Length; i++) { DoDebug(mList [i]); yield return(StartCoroutine(loadMon(mList [i]))); monsterList [i] = mon; } // Assign Monsters and Characters to everything for (int i = 0; i < players.Length; i++) { players[i].GetComponent <PlayerMovement>().characterInfo = chList[i]; players[i].GetComponent <PlayerMovement>().health = chList[i].getHP(); } // Note: When Assigning monsters, going based on monster list on Firebase // Goes Patrol Charge, Boss, Wander Stalk. GameObject[] temp = GameObject.FindGameObjectsWithTag("PatrolEnemy"); for (int a = 0; a < temp.Length; a++) { temp[a].gameObject.GetComponent <MonsterStorage>().monster = monsterList[0]; temp[a].gameObject.GetComponent <MonsterStorage>().health = monsterList[0].getHP(); } GameObject[] temp2 = GameObject.FindGameObjectsWithTag("WanderEnemy"); for (int a = 0; a < temp2.Length; a++) { temp2[a].gameObject.GetComponent <MonsterStorage>().monster = monsterList[2]; temp2[a].gameObject.GetComponent <MonsterStorage>().health = monsterList[2].getHP(); } GameObject[] temp3 = GameObject.FindGameObjectsWithTag("BossEnemy"); for (int a = 0; a < temp3.Length; a++) { temp3[a].gameObject.GetComponent <MonsterStorage>().monster = monsterList[1]; temp3[a].gameObject.GetComponent <MonsterStorage>().health = monsterList[1].getHP(); } //getMons (monList); // See if this runs once all done. It should. loading = false; yield return(new WaitForSeconds(1f)); }