diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Room1.tscn b/DungeonShooting_Godot/resource/map/tileMaps/Room1.tscn
index bee2fc8..cb89658 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/Room1.tscn
+++ b/DungeonShooting_Godot/resource/map/tileMaps/Room1.tscn
@@ -23,9 +23,20 @@
[node name="EnemyMark2" type="Node2D" parent="."]
position = Vector2(118, 74)
script = ExtResource("3_2xk8s")
+Weapon1Id = "0002"
Type = 3
ItemId = "0001"
Layer = 1
+WaveNumber = 2
+
+[node name="EnemyMark3" type="Node2D" parent="."]
+position = Vector2(117, 4)
+script = ExtResource("3_2xk8s")
+Weapon1Id = "0003"
+Type = 3
+ItemId = "0001"
+Layer = 1
+WaveNumber = 3
[node name="WeaponMark" type="Node2D" parent="."]
position = Vector2(-120, 72)
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
index f2e379a..6f1bc50 100644
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
@@ -344,11 +344,11 @@
}
///
- /// 返回当物体 CollisionLayer 是否能与 layer 层碰撞
+ /// 返回当物体 CollisionLayer 是否能与 mask 层碰撞
///
- public bool CollisionWithLayer(uint layer)
+ public bool CollisionWithMask(uint mask)
{
- return (CollisionLayer & layer) != 0;
+ return (CollisionLayer & mask) != 0;
}
///
diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs
index 0e8b005..052042d 100644
--- a/DungeonShooting_Godot/src/framework/common/Utils.cs
+++ b/DungeonShooting_Godot/src/framework/common/Utils.cs
@@ -98,6 +98,14 @@
Mathf.Abs(start1 - start2), Mathf.Abs(end1 - end2)
);
}
+
+ ///
+ /// 返回碰撞层 mask 是否会检测 layer
+ ///
+ public static bool CollisionMaskWithLayer(uint mask, uint layer)
+ {
+ return (mask & layer) != 0;
+ }
///
/// 使用定的 canvasItem 绘制导航区域, 注意, 该函数只能在 draw 函数中调用
diff --git a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/RoomInfo.cs
index 195cfcb..c96b5f0 100644
--- a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs
+++ b/DungeonShooting_Godot/src/framework/map/RoomInfo.cs
@@ -63,6 +63,9 @@
///
public bool IsSeclusion { get; private set; } = false;
+ private bool _waveStart = false;
+ private int _currWaveNumber = 0;
+
///
/// 获取房间的全局坐标, 单位: 像素
///
@@ -121,6 +124,11 @@
///
public void BeReady()
{
+ //没有标记, 不需要关门
+ if (ActivityMarks.Count == 0)
+ {
+ return;
+ }
IsSeclusion = true;
//按照 WaveNumber 排序
@@ -135,17 +143,25 @@
doorInfo.Door.CloseDoor();
}
+ NextWave();
+ }
+
+ ///
+ /// 执行下一轮标记
+ ///
+ public void NextWave()
+ {
+ if (!_waveStart)
+ {
+
+ }
+
//根据标记生成对象
foreach (var mark in ActivityMarks)
{
mark.BeReady(this);
}
}
-
- public void NextWave()
- {
-
- }
///
/// 当前房间所有敌人都被清除了
diff --git a/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs b/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs
index e9837ca..d3a167e 100644
--- a/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs
+++ b/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs
@@ -46,7 +46,7 @@
}
///
- /// 调用该函数表示该标记可以生成物体了
+ /// 调用该函数表示该标记可以生成物体了, 使用标记创建实例必须调用 CreateInstance(id)
///
public virtual void BeReady(RoomInfo roomInfo)
{
@@ -54,7 +54,12 @@
instance.PutDown(GlobalPosition, Layer);
Visible = false;
}
-
+
+ protected T CreateInstance(string id) where T : ActivityObject
+ {
+ return default;
+ }
+
public override void _Draw()
{
if (Engine.IsEditorHint() || GameApplication.Instance.Debug)
diff --git a/DungeonShooting_Godot/src/game/room/RoomManager.cs b/DungeonShooting_Godot/src/game/room/RoomManager.cs
index 8f3e8b1..2c81832 100644
--- a/DungeonShooting_Godot/src/game/room/RoomManager.cs
+++ b/DungeonShooting_Godot/src/game/room/RoomManager.cs
@@ -256,7 +256,7 @@
{
var inst = (ActivityObject)o;
var count = ActiveAffiliation.FindIncludeItemsCount(
- activityObject => activityObject != inst && activityObject.CollisionWithLayer(PhysicsLayer.Enemy)
+ activityObject => activityObject != inst && activityObject.CollisionWithMask(PhysicsLayer.Enemy)
);
if (count == 0)
{