void setEnemyMaxTime() { if (infoDump == null) { return; } activeTime.setEnemyMaxTime(infoDump.info.enemy0Max); if (enemy2ActiveTime != null) { enemy2ActiveTime.setEnemyMaxTime(infoDump.info.enemy1Max); } if (enemy3ActiveTime != null) { enemy3ActiveTime.setEnemyMaxTime(infoDump.info.enemy2Max); } }
void moreEnemies() { if (numEnemies == 2) { enemies[1] = new Monster(5, 1, 1, 1, 1, false, 1, 1, 1); enemy2HP = enemies[1].getHP(); stateQueue.Add(BattleScreenStates.FightStates.SECONDENEMYJOINS); enemy2ActiveTime = transform.FindChild("EnemyPanel/Enemy2").GetComponent <ActiveTime>(); enemy2ActiveTime.setEnemyMaxTime(20); } else if (numEnemies == 3) { enemies[2] = new Monster(5, 1, 1, 1, 1, false, 1, 1, 1); enemy3HP = enemies[2].getHP(); stateQueue.Add(BattleScreenStates.FightStates.THIRDENEMYJOINS); enemy3ActiveTime = transform.FindChild("EnemyPanel/Enemy3").GetComponent <ActiveTime>(); enemy3ActiveTime.setEnemyMaxTime(25); } }
// Instead of start function, call this with a little delay (maybe .1s). // This will assign everything from infoDump. Delay is used to make sure Info dump has been assigned. void startFromDump() { attack = GetComponent <BattleAttackHandler>(); state = GetComponent <BattleScreenStates>(); selection = GetComponent <ArrowSelection>(); stateQueue = new List <BattleScreenStates.FightStates>(); stateQueue.Add(BattleScreenStates.FightStates.BEGINNING); activeTime = transform.FindChild("PlayerInfo/ActiveTimeBar").GetComponent <ActiveTime>(); enemies = new Monster[3]; if (infoDump != null) { enemies[0] = infoDump.enemy0; enemies[1] = infoDump.enemy1; enemies[2] = infoDump.enemy2; activeTime.setEnemyMaxTime(infoDump.info.enemy0Max); activeTime.setEnemySeconds(infoDump.info.enemy0Sec); if (infoDump.info.numEnemies > 2) { enemy2ActiveTime.setEnemyMaxTime(infoDump.info.enemy1Max); enemy2ActiveTime.setEnemySeconds(infoDump.info.enemy1Sec); enemy3ActiveTime.setEnemyMaxTime(infoDump.info.enemy2Max); enemy3ActiveTime.setEnemySeconds(infoDump.info.enemy2Sec); } else if (infoDump.info.numEnemies > 1) { enemy2ActiveTime.setEnemyMaxTime(infoDump.info.enemy1Max); enemy2ActiveTime.setEnemySeconds(infoDump.info.enemy1Sec); } numPlayers = infoDump.info.numPlayers; numEnemies = infoDump.info.numEnemies; playerNum = infoDump.info.numPlayers - 1; setEnemyHP(); switch (playerNum) { case 0: character = infoDump.player0; break; case 1: character = infoDump.player1; break; case 2: character = infoDump.player2; break; default: print("Character still null in Battle Logic"); break; } playerMaxHP = character.getHP(); setPlayerHP(); enemyAttackFlag = infoDump.info.enemyAttackFlag; setEnemyMaxTime(); setEnemyTime(); GetComponent <BattleScreenGUI>().fillSkillButtons(); } else { print("infoDUmp null"); } dumpLoad = false; for (int i = 0; i < enemies.Length; i++) { //enemies[i].setDead(false); } }