public virtual void Update() { if (in_cd) { //Manage the Radial Fill Cooldown float final_time = cd_time - act_time; if (final_time <= 0.0f) { final_time = 0.0f; } calc_time = final_time / cd_time; fill_image.FillAmount(calc_time); //Manage Logical CD time act_time += Time.deltaTime; //Detect when activate the button again if (act_time >= cd_time) { in_cd = false; button_cd.Activate(); fill_image.FillAmount(1.0f); reset_timer = true; } } }
public void SetHP(float curr_health, float max_health) { current_hp = curr_health; max_hp = max_health; calc_hp = current_hp / max_hp; hp_bar = this_obj_hp.GetComponent <CompImage>(); hp_bar.FillAmount(calc_hp); }
public void SetStamina(float curr_stam, float max_stam) { curr_stamina = curr_stam; max_stamina = max_stam; calc_stamina = curr_stamina / max_stamina; stamina_bar = this_obj_stamina.GetComponent <CompImage>(); stamina_bar.FillAmount(calc_stamina); }
public void SetMana(float curr_man, float max_man) { curr_mana = curr_man; max_mana = max_man; calc_mana = curr_mana / max_mana; mana_bar = this_obj_mana.GetComponent <CompImage>(); mana_bar.FillAmount(calc_mana); }
void Update() { no_stamina.GetComponent <CompImage>().FillAmount(calc_stamina); if (!wasted_stamina) { if (curr_stamina < max_stamina) { curr_stamina += regen; if (curr_stamina > max_stamina) { curr_stamina = max_stamina; } calc_stamina = curr_stamina / max_stamina; stamina_bar = this_obj_stamina.GetComponent <CompImage>(); stamina_bar.FillAmount(calc_stamina); } } else { wasted_stamina_time += Time.deltaTime; if (wasted_stamina_time >= wait_for_stamina_recovery) { wasted_stamina = false; } } if (not_enough_stamina) { flickering_time += Time.deltaTime; if (flickering_time >= stamina_flickering_time) { no_stamina.GetComponent <CompImage>().ActivateRender(); } if (flickering_time >= stamina_flickering_time * 2) { no_stamina.GetComponent <CompImage>().DeactivateRender(); } if (flickering_time >= stamina_flickering_time * 3) { no_stamina.GetComponent <CompImage>().ActivateRender(); } if (flickering_time >= stamina_flickering_time * 4) { no_stamina.GetComponent <CompImage>().DeactivateRender(); not_enough_stamina = false; } } }
public void GetDamage(float dmg) { other_obj_hp.GetComponent <CompImage>().FillAmount(current_hp / max_hp); other_obj_hp.GetComponent <LeftHp>().current_lasthp = current_hp; other_obj_hp.GetComponent <LeftHp>().hp_ready_to_below = false; other_obj_hp.GetComponent <LeftHp>().current_temp_hp_time = 0.0f; other_obj_hp.GetComponent <LeftHp>().hp_bar_changed = true; current_hp -= dmg; if (current_hp < 0) { current_hp = 0; } calc_hp = current_hp / max_hp; hp_bar = this_obj_hp.GetComponent <CompImage>(); hp_bar.FillAmount(calc_hp); other_obj_hp.GetComponent <LeftHp>().lasthp_value = current_hp; }
public void DecreaseStamina(float cost) { //Costs are 0 in GOD MODE if (GetLinkedObject("player_obj").GetComponent <CharactersManager>().god_mode || GetLinkedObject("player_obj").GetComponent <CharactersManager>().no_energy) { cost = 0; } other_bar_lastamina.GetComponent <Leftamina>().lastamina_value = curr_stamina; if (curr_stamina > cost) { curr_stamina -= cost; } calc_stamina = curr_stamina / max_stamina; stamina_bar = this_obj_stamina.GetComponent <CompImage>(); stamina_bar.FillAmount(calc_stamina); other_bar_lastamina.GetComponent <Leftamina>().stamina_bar_changed = false; }
public void DecreaseManaPercentage(float cost_percentage) { //Costs are 0 in GOD MODE if (GetLinkedObject("player_obj").GetComponent <CharactersManager>().god_mode || GetLinkedObject("player_obj").GetComponent <CharactersManager>().no_energy) { cost_percentage = 0; } float cost = cost_percentage * max_mana / 100.0f; other_obj_lastmana.GetComponent <LeftMana>().lastmana_value = curr_mana; if (curr_mana > cost) { curr_mana -= cost; } calc_mana = curr_mana / max_mana; mana_bar = this_obj_mana.GetComponent <CompImage>(); mana_bar.FillAmount(calc_mana); other_obj_lastmana.GetComponent <LeftMana>().mana_bar_changed = false; }
public void SetHPBar(float hp_percentage) { CompImage hp_bar = gameObject.GetComponent <CompImage>(); hp_bar.FillAmount(hp_percentage); }
void FillComboBar(float time) { calc_time = time / max_time; combo_bar = this_combo_bar_obj.GetComponent <CompImage>(); combo_bar.FillAmount(calc_time); }