//Update enemy UI in battle (updates health/energy) private void UpdateEnemyBar(bool[] alive, GameObject UI, int index) { if (alive[index]) { if (UI.activeSelf) { //Update Bar IBattle enemyScript = player.GetComponent <PlayerManager>().currentBattleArea.GetEnemyScripts()[index]; if (enemyScript) { enemyHealthBarImages[index].GetComponent <Image>().fillAmount = enemyScript.GetHealth() / enemyScript.MAX_HEALTH; enemyEnergyBarImages[index].GetComponent <Image>().fillAmount = enemyScript.GetEnergy() / enemyScript.MAX_ENERGY; enemyHealthBarText[index].GetComponent <Text>().text = Mathf.Ceil(enemyScript.GetHealth()).ToString(); enemyEnergyBarText[index].GetComponent <Text>().text = Mathf.Ceil(enemyScript.GetEnergy()).ToString(); } } else { UI.SetActive(true); } } else { if (UI.activeSelf) { UI.SetActive(false); } } }