Skip to content

Commit

Permalink
Update HealthBar
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jul 16, 2024
1 parent a7f2432 commit 4c9ad5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Binary file modified Fika.Core/Bundles/Files/playerui.bundle
Binary file not shown.
20 changes: 14 additions & 6 deletions Fika.Core/Coop/Custom/FikaHealthBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ private void CreateHealthBar()
{
currentPlayer.HealthController.EffectAddedEvent += HealthController_EffectAddedEvent;
currentPlayer.HealthController.EffectRemovedEvent += HealthController_EffectRemovedEvent;
AddAllActiveEffects();
}

FikaPlugin.UsePlateFactionSide.SettingChanged += UsePlateFactionSide_SettingChanged;
Expand Down Expand Up @@ -262,12 +263,7 @@ private void ShowEffects_SettingChanged(object sender, EventArgs e)
{
currentPlayer.HealthController.EffectAddedEvent += HealthController_EffectAddedEvent;
currentPlayer.HealthController.EffectRemovedEvent += HealthController_EffectRemovedEvent;

IEnumerable<IEffect> currentEffects = currentPlayer.HealthController.GetAllActiveEffects();
foreach (IEffect effect in currentEffects)
{
AddEffect(effect);
}
AddAllActiveEffects();
}
else
{
Expand All @@ -285,6 +281,15 @@ private void ShowEffects_SettingChanged(object sender, EventArgs e)
}
}

private void AddAllActiveEffects()
{
IEnumerable<IEffect> currentEffects = currentPlayer.HealthController.GetAllActiveEffects();
foreach (IEffect effect in currentEffects)
{
AddEffect(effect);
}
}

private void HealthController_DiedEvent(EDamageType obj)
{
Destroy(this);
Expand Down Expand Up @@ -413,7 +418,10 @@ protected void OnDestroy()
currentPlayer.HealthController.EffectAddedEvent -= HealthController_EffectAddedEvent;
currentPlayer.HealthController.EffectRemovedEvent -= HealthController_EffectRemovedEvent;



playerPlate.gameObject.SetActive(false);
effects.Clear();
Destroy(this);
}

Expand Down

0 comments on commit 4c9ad5a

Please sign in to comment.