diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index a7580e3..bdf0188 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -154,6 +154,7 @@ { if (World != null) { + ClearWorld(); World.QueueFree(); } World = ResourceManager.LoadAndInstantiate(ResourcePath.scene_World_tscn); @@ -168,6 +169,7 @@ { if (World != null) { + ClearWorld(); World.QueueFree(); } @@ -271,6 +273,30 @@ cursorLayer.AddChild(Cursor); } + //清理世界 + private void ClearWorld() + { + + var childCount = World.NormalLayer.GetChildCount(); + for (var i = 0; i < childCount; i++) + { + var c = World.NormalLayer.GetChild(i); + if (c is IDestroy destroy) + { + destroy.Destroy(); + } + } + childCount = World.YSortLayer.GetChildCount(); + for (var i = 0; i < childCount; i++) + { + var c = World.YSortLayer.GetChild(i); + if (c is IDestroy destroy) + { + destroy.Destroy(); + } + } + } + #if TOOLS //调试模式下, 指定生成哪些房间 private void InitDesignatedRoom() diff --git a/DungeonShooting_Godot/src/game/buff/RoleState.cs b/DungeonShooting_Godot/src/game/buff/RoleState.cs new file mode 100644 index 0000000..53bcff3 --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/RoleState.cs @@ -0,0 +1,11 @@ + +/// +/// 角色属性类 +/// +public class RoleState +{ + /// + /// 移动速度 + /// + public float MoveSpeed; +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/State.cs b/DungeonShooting_Godot/src/game/buff/State.cs deleted file mode 100644 index cca36d1..0000000 --- a/DungeonShooting_Godot/src/game/buff/State.cs +++ /dev/null @@ -1,5 +0,0 @@ - -public class State -{ - -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index f84968b..cab98e4 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -490,11 +490,7 @@ private void DisposeRoomInfo(RoomInfo roomInfo) { - foreach (var activityMark in roomInfo.ActivityMarks) - { - activityMark.QueueFree(); - } - roomInfo.ActivityMarks.Clear(); + roomInfo.Destroy(); } public override void _Draw()