void Start() { // Player and Enemy initialization player_c_health_0 = player_team[0].healthCumulative(); player_c_health[0] = player_c_health_0; player_c_health_1 = player_team[1].healthCumulative(); player_c_health[1] = player_c_health_1; player_c_health_2 = player_team[2].healthCumulative(); player_c_health[2] = player_c_health_2; enemy_c_health_0 = enemy_team[0].healthCumulative(); enemy_c_health[0] = enemy_c_health_0; enemy_c_health_1 = enemy_team[1].healthCumulative(); enemy_c_health[1] = enemy_c_health_1; enemy_c_health_2 = enemy_team[2].healthCumulative(); enemy_c_health[2] = enemy_c_health_2; // Player and Enemy team setting current_beetleboi = player_team[0]; health_bar.maxValue = player_c_health_0; current_health = player_c_health_0; e_current_beetleboi = enemy_team[0]; e_health_bar.maxValue = enemy_c_health_0; e_current_health = enemy_c_health_0; // Playre and Enemy button setting player_buttons[0].GetComponent <Image>().sprite = player_team[0].myIcon.sprite; player_buttons[1].GetComponent <Image>().sprite = player_team[1].myIcon.sprite; player_buttons[2].GetComponent <Image>().sprite = player_team[2].myIcon.sprite; enemy_buttons[0].GetComponent <Image>().sprite = enemy_team[0].myIcon.sprite; enemy_buttons[1].GetComponent <Image>().sprite = enemy_team[1].myIcon.sprite; enemy_buttons[2].GetComponent <Image>().sprite = enemy_team[2].myIcon.sprite; }
void switchEnemyBeetle(int index) // set value for fainted beetle and set index beetle to be the current beetle { int old_index = System.Array.IndexOf(enemy_team, e_current_beetleboi); enemy_c_health[old_index] = e_current_health; if (e_current_health == 0) { enemy_buttons[old_index].interactable = false; } e_current_beetleboi = enemy_team[index]; e_health_bar.maxValue = e_current_beetleboi.healthCumulative(); e_current_health = enemy_c_health[index]; animationManager.e_switchBeetle(); }
public void switchBeetle(int index) // attached to a button to execute beetle switching { int old_index = System.Array.IndexOf(player_team, current_beetleboi); player_c_health[old_index] = current_health; if (current_health == 0) { player_buttons[old_index].interactable = false; } current_beetleboi = player_team[index]; health_bar.maxValue = current_beetleboi.healthCumulative(); current_health = player_c_health[index]; animationManager.switchBeetle(); }