diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index 088413b..a9910a7 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -130,7 +130,7 @@ public partial class CharacterTemplate : CharacterBody2D ///Sets the amount of Hp a character has after resurrection ///设置角色复活后拥有的Hp /// - public void Revive(int newHp) + public virtual void Revive(int newHp) { //If the new Hp is less than or equal to 0, there is no need to resurrect //如果新的Hp小于等于0,那么不需要复活 diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs index 2c754d9..a6c57fd 100644 --- a/scripts/character/Player.cs +++ b/scripts/character/Player.cs @@ -378,6 +378,18 @@ public partial class Player : CharacterTemplate } } + public override void Revive(int newHp) + { + base.Revive(newHp); + var healthBarUi = GameSceneNodeHolder.HealthBarUi; + if (healthBarUi!=null) + { + //The purpose of setting Hp to the current Hp is to cause the life bar to refresh. + //将Hp设置为当前Hp的目的是,使生命条刷新。 + healthBarUi.CurrentHp = CurrentHp; + } + } + protected override async Task OnDie(DamageTemplate damageTemplate) { Visible = false; diff --git a/scripts/loader/sceneLoader/GameSceneLoader.cs b/scripts/loader/sceneLoader/GameSceneLoader.cs index 0a7f7d6..eb550eb 100644 --- a/scripts/loader/sceneLoader/GameSceneLoader.cs +++ b/scripts/loader/sceneLoader/GameSceneLoader.cs @@ -9,6 +9,10 @@ using Godot; namespace ColdMint.scripts.loader.sceneLoader; +/// +/// Game scene loader +/// 游戏场景加载器 +/// public partial class GameSceneLoader : SceneLoaderTemplate { private Label? _seedLabel; @@ -55,7 +59,7 @@ public partial class GameSceneLoader : SceneLoaderTemplate _seedLabel = GetNodeOrNull