From 4c61f3b50e9b86764b441f4a01539360654ee153 Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Wed, 5 Jun 2024 22:15:23 +0800 Subject: [PATCH] =?UTF-8?q?Remove=20unused=20source=20files.=20Fixed=20an?= =?UTF-8?q?=20issue=20where=20the=20health=20tank=20was=20empty=20after=20?= =?UTF-8?q?resurrection.=20=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=BA=90=E6=96=87=E4=BB=B6=E3=80=82=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=A4=8D=E6=B4=BB=E5=90=8E=E7=94=9F=E5=91=BD=E6=A7=BD=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/character/CharacterTemplate.cs | 2 +- scripts/character/Player.cs | 12 +++++ scripts/loader/sceneLoader/GameSceneLoader.cs | 16 +++---- .../SequenceLayoutParsingStrategy.cs | 29 +++++++----- scripts/map/interfaces/IRoomHolder.cs | 28 ----------- scripts/map/interfaces/IRoomTemplate.cs | 35 -------------- .../map/layoutStrategy/TestLayoutStrategy.cs | 6 +-- scripts/map/room/RoomTemplate.cs | 46 ------------------- scripts/map/roomHolder/RoomHolder.cs | 31 ------------- .../PatchworkRoomPlacementStrategy.cs | 2 + 10 files changed, 42 insertions(+), 165 deletions(-) delete mode 100644 scripts/map/interfaces/IRoomHolder.cs delete mode 100644 scripts/map/interfaces/IRoomTemplate.cs delete mode 100644 scripts/map/room/RoomTemplate.cs delete mode 100644 scripts/map/roomHolder/RoomHolder.cs 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