void Update() { playerHealthString.text = (battleLogic.getPlayerHP()).ToString() + "/" + battleLogic.getPlayerMaxHP(); playerHealthBar.fillAmount = (battleLogic.getPlayerHP()) / battleLogic.getPlayerMaxHP(); playerActiveTimerBar.fillAmount = activeTime.GetRatio(); stateCheck(); character = battleLogic.getCharacter(); enemies = battleLogic.getEnemies(); checkDeadEnemies(); }
void stateCheck() { if (activeTime == null) { return; } if (activeTime.GetEnemyRatio() == 1) { print("Enemy attacking"); stateQueue.Add(BattleScreenStates.FightStates.ENEMYTURN); activeTime.setEnemySeconds(0); if (infoDump != null) { sendAttackFlag(true); // Need Command to do this } } if (numEnemies == 2 && enemy2ActiveTime.GetEnemyRatio() == 1) { stateQueue.Add(BattleScreenStates.FightStates.ENEMYTURN); enemy2ActiveTime.setEnemySeconds(5); if (infoDump != null) { sendAttackFlag(true); // Need Command to do this } } if (numEnemies == 3 && enemy3ActiveTime.GetEnemyRatio() == 1) { stateQueue.Add(BattleScreenStates.FightStates.ENEMYTURN); enemy3ActiveTime.setEnemySeconds(10); if (infoDump != null) { sendAttackFlag(true); // Need Command to do this } } if (currentMoveSelected && numEnemies > 1 && state.curState == BattleScreenStates.FightStates.NEUTRAL && !playerAttackFlag) { stateQueue.Add(BattleScreenStates.FightStates.PICKANENEMY); currentMoveSelected = false; toggleState(); } else if (state.curState == BattleScreenStates.FightStates.PICKANENEMY) { if (Input.GetKeyDown("space")) { toggleState(); currentMoveSelected = true; playerAttackFlag = true; } } else if (activeTime.GetRatio() == 1 && currentMoveSelected) { stateQueue.Add(BattleScreenStates.FightStates.PLAYERTURN); activeTime.setSeconds(0); currentMoveSelected = false; playerAttackFlag = true; toggleState(); } stateTakesEffect(); }