diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
index bb37d00..0cc0d6a 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
@@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"]
[ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_gkcw7"]
-[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="2_vrg60"]
+[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileSet/TileSet1.tres" id="2_vrg60"]
[ext_resource type="Texture2D" uid="uid://cat35d7ueu7gu" path="res://resource/sprite/ui/commonIcon/Save.png" id="3_qq8k4"]
[ext_resource type="Texture2D" uid="uid://7l7aqhsaexoh" path="res://resource/sprite/ui/commonIcon/Play.png" id="4_2imnr"]
[ext_resource type="Texture2D" uid="uid://0878uloew5jo" path="res://resource/sprite/ui/mapEditor/ErrorCell.png" id="4_465u2"]
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Battle1/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Battle1/Preinstall.json
index ce70790..fa1a899 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Battle1/Preinstall.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Battle1/Preinstall.json
@@ -1 +1 @@
-[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[]]}]
\ No newline at end of file
+[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":-4,"Y":-6},"Size":{"X":30,"Y":26},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0002","CurrAmmon":"7","ResidueAmmo":"7"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":38,"Y":48},"Size":{"X":31,"Y":25},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0002","CurrAmmon":"7","ResidueAmmo":"7"},"Altitude":0,"VerticalSpeed":0}]}]]}]
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Battle3/Preview.png.import b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Battle3/Preview.png.import
new file mode 100644
index 0000000..792054f
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Battle3/Preview.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://b3m084aaip558"
+path="res://.godot/imported/Preview.png-8c476da21cd7f2ad84205fc0a7e6692d.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/map/tileMaps/TestGroup1/battle/Battle3/Preview.png"
+dest_files=["res://.godot/imported/Preview.png-8c476da21cd7f2ad84205fc0a7e6692d.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
index 263c49c..5bfbc5c 100644
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
@@ -1181,15 +1181,10 @@
OnDestroy();
var arr = _components.ToArray();
- for (int i = 0; i < arr.Length; i++)
+ for (var i = 0; i < arr.Length; i++)
{
arr[i].Value?.Destroy();
}
-
- if (AffiliationArea != null)
- {
- AffiliationArea.RemoveItem(this);
- }
}
///
diff --git a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs
index 337dab2..78ebfd9 100644
--- a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs
+++ b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs
@@ -69,7 +69,7 @@
if (activityObject.AffiliationArea != null)
{
- _includeItems.Remove(activityObject);
+ activityObject.AffiliationArea._includeItems.Remove(activityObject);
}
activityObject.AffiliationArea = this;
_includeItems.Add(activityObject);
@@ -111,7 +111,7 @@
var count = 0;
foreach (var activityObject in _includeItems)
{
- if (handler(activityObject))
+ if (!activityObject.IsDestroyed && handler(activityObject))
{
count++;
}
@@ -128,7 +128,7 @@
var list = new List();
foreach (var activityObject in _includeItems)
{
- if (handler(activityObject))
+ if (!activityObject.IsDestroyed && handler(activityObject))
{
list.Add(activityObject);
}
@@ -144,7 +144,7 @@
{
foreach (var activityObject in _includeItems)
{
- if (handler(activityObject))
+ if (!activityObject.IsDestroyed && handler(activityObject))
{
return true;
}
diff --git a/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs
index 9f8d4b6..edc96e5 100644
--- a/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs
+++ b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs
@@ -196,9 +196,12 @@
IsRunWave = true;
_currWaveIndex = 1;
- GD.Print("执行第一波");
- _coroutineId = GameApplication.Instance.StartCoroutine(RunMark(WaveList[_currWaveIndex]));
- _currWaveIndex++;
+ if (_currWaveIndex < WaveList.Count)
+ {
+ GD.Print("执行第一波");
+ _coroutineId = GameApplication.Instance.StartCoroutine(RunMark(WaveList[_currWaveIndex]));
+ _currWaveIndex++;
+ }
}
public void NextWave()
diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs
index a486132..6f69973 100644
--- a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs
+++ b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs
@@ -205,22 +205,23 @@
{
return;
}
- //没有额外标记, 啥都不要做
- if (RoomPreinstall.WaveCount <= 1)
- {
- IsSeclusion = false;
- return;
- }
- IsSeclusion = true;
//会刷新敌人才要关门
- if (RoomPreinstall.HasEnemy())
+ var enemies = GameApplication.Instance.DungeonManager.World.Enemy_InstanceList;
+ if (RoomPreinstall.HasEnemy() ||
+ enemies.FindIndex(item => item.AffiliationArea == AffiliationArea) != -1)
{
//关门
foreach (var doorInfo in Doors)
{
doorInfo.Door.CloseDoor();
}
+ IsSeclusion = true;
+ }
+ else if (RoomPreinstall.WaveCount <= 1) //没有额外标记, 啥都不要做
+ {
+ IsSeclusion = false;
+ return;
}
//执行第一波生成
diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs
index d53f94d..1762c28 100644
--- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs
+++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs
@@ -39,13 +39,17 @@
///
public DungeonConfig CurrConfig { get; private set; }
+ ///
+ /// 当前使用的世界对象
+ ///
+ public World World { get; private set; }
+
private UiBase _prevUi;
private DungeonTileMap _dungeonTileMap;
private AutoTileConfig _autoTileConfig;
private DungeonGenerator _dungeonGenerator;
//房间内所有静态导航网格数据
private List _roomStaticNavigationList;
- private World _world;
//用于检查房间敌人的计时器
private float _checkEnemyTimer = 0;
@@ -172,7 +176,7 @@
UiManager.Open_Loading();
yield return 0;
//创建世界场景
- _world = GameApplication.Instance.CreateNewWorld();
+ World = GameApplication.Instance.CreateNewWorld();
yield return new WaitForFixedProcess(10);
//生成地牢房间
_dungeonGenerator = new DungeonGenerator(CurrConfig);
@@ -181,7 +185,7 @@
//填充地牢
_autoTileConfig = new AutoTileConfig();
- _dungeonTileMap = new DungeonTileMap(_world.TileRoot);
+ _dungeonTileMap = new DungeonTileMap(World.TileRoot);
_dungeonTileMap.AutoFillRoomTile(_autoTileConfig, _dungeonGenerator.StartRoomInfo, _dungeonGenerator.Random);
yield return 0;
@@ -189,7 +193,7 @@
_dungeonTileMap.GenerateNavigationPolygon(GameConfig.AisleFloorMapLayer);
yield return 0;
//挂载过道导航区域
- _dungeonTileMap.MountNavigationPolygon(_world.TileRoot);
+ _dungeonTileMap.MountNavigationPolygon(World.TileRoot);
yield return 0;
//过道导航区域数据
_roomStaticNavigationList = new List();
@@ -256,7 +260,7 @@
//打开 loading UI
UiManager.Open_Loading();
yield return 0;
- _world.Pause = true;
+ World.Pause = true;
yield return 0;
_dungeonGenerator.EachRoom(DisposeRoomInfo);
yield return 0;
@@ -269,7 +273,7 @@
UiManager.Hide_RoomUI();
yield return new WaitForFixedProcess(10);
Player.SetCurrentPlayer(null);
- _world = null;
+ World = null;
GameApplication.Instance.DestroyWorld();
yield return new WaitForFixedProcess(10);
QueueRedraw();
@@ -326,7 +330,7 @@
var navigationPolygon = new NavigationRegion2D();
navigationPolygon.Name = "NavigationRegion" + (GetChildCount() + 1);
navigationPolygon.NavigationPolygon = polygon;
- _world.TileRoot.AddChild(navigationPolygon);
+ World.TileRoot.AddChild(navigationPolygon);
}
//创建门
@@ -376,7 +380,7 @@
(roomInfo.Size - new Vector2I(2, 2)) * GameConfig.TileCellSize));
roomInfo.AffiliationArea = affiliation;
- _world.AffiliationAreaRoot.AddChild(affiliation);
+ World.AffiliationAreaRoot.AddChild(affiliation);
}
//创建静态精灵画布
@@ -470,7 +474,7 @@
maxX += GameConfig.TileCellSize;
maxY += GameConfig.TileCellSize;
var staticSpriteCanvas = new RoomStaticImageCanvas(
- _world.StaticSpriteRoot,
+ World.StaticSpriteRoot,
new Vector2I(minX, minY),
maxX - minX, maxY - minY
);
@@ -489,7 +493,7 @@
if (room.IsSeclusion)
{
var playerAffiliationArea = Player.Current.AffiliationArea;
- foreach (var enemy in _world.Enemy_InstanceList)
+ foreach (var enemy in World.Enemy_InstanceList)
{
//不与玩家处于同一个房间
if (enemy.AffiliationArea != playerAffiliationArea)
@@ -541,21 +545,21 @@
///
private void UpdateEnemiesView()
{
- _world.Enemy_IsFindTarget = false;
- _world.Enemy_FindTargetAffiliationSet.Clear();
- for (var i = 0; i < _world.Enemy_InstanceList.Count; i++)
+ World.Enemy_IsFindTarget = false;
+ World.Enemy_FindTargetAffiliationSet.Clear();
+ for (var i = 0; i < World.Enemy_InstanceList.Count; i++)
{
- var enemy = _world.Enemy_InstanceList[i];
+ var enemy = World.Enemy_InstanceList[i];
var state = enemy.StateController.CurrState;
if (state == AiStateEnum.AiFollowUp || state == AiStateEnum.AiSurround) //目标在视野内
{
- if (!_world.Enemy_IsFindTarget)
+ if (!World.Enemy_IsFindTarget)
{
- _world.Enemy_IsFindTarget = true;
- _world.Enemy_FindTargetPosition = Player.Current.GetCenterPosition();
- _world.Enemy_FindTargetAffiliationSet.Add(Player.Current.AffiliationArea);
+ World.Enemy_IsFindTarget = true;
+ World.Enemy_FindTargetPosition = Player.Current.GetCenterPosition();
+ World.Enemy_FindTargetAffiliationSet.Add(Player.Current.AffiliationArea);
}
- _world.Enemy_FindTargetAffiliationSet.Add(enemy.AffiliationArea);
+ World.Enemy_FindTargetAffiliationSet.Add(enemy.AffiliationArea);
}
}
}
@@ -587,7 +591,7 @@
//绘制房间区域, debug 用
private void DrawRoomInfo(RoomInfo roomInfo)
{
- var cellSize = _world.TileRoot.CellQuadrantSize;
+ var cellSize = World.TileRoot.CellQuadrantSize;
var pos1 = (roomInfo.Position + roomInfo.Size / 2) * cellSize;
//绘制下一个房间