diff --git a/DungeonShooting_Godot/prefab/role/Role0001.tscn b/DungeonShooting_Godot/prefab/role/Role0001.tscn
index 71e4939e..11cf9686 100644
--- a/DungeonShooting_Godot/prefab/role/Role0001.tscn
+++ b/DungeonShooting_Godot/prefab/role/Role0001.tscn
@@ -24,7 +24,7 @@ size = Vector2(12, 18)
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ka171"]
[node name="Role0001" node_paths=PackedStringArray("HurtArea", "HurtCollision", "InteractiveArea", "InteractiveCollision", "TipRoot", "TipSprite", "AnimationPlayer", "MountPoint", "BackMountPoint", "MeleeAttackArea", "MeleeAttackCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_10c2n")]
-collision_layer = 8
+collision_layer = 24
script = ExtResource("2_6xwnt")
HurtArea = NodePath("HurtArea")
HurtCollision = NodePath("HurtArea/HurtCollision")
diff --git a/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn b/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn
index 102bf011..ad4f5841 100644
--- a/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn
+++ b/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn
@@ -46,7 +46,7 @@ position = Vector2(0, -2)
shape = SubResource("CircleShape2D_5pj80")
[node name="HurtArea" type="Area2D" parent="."]
-collision_layer = 0
+collision_layer = 1024
collision_mask = 0
monitoring = false
script = ExtResource("2_2eey0")
diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot
index 9c428530..18222925 100644
--- a/DungeonShooting_Godot/project.godot
+++ b/DungeonShooting_Godot/project.godot
@@ -246,13 +246,13 @@ roulette={
2d_physics/layer_2="bullet"
2d_physics/layer_3="prop"
2d_physics/layer_4="player"
-2d_physics/layer_5="enemy"
+2d_physics/layer_5="role"
2d_physics/layer_6="affiliation"
2d_physics/layer_7="onHand"
2d_physics/layer_8="debris"
2d_physics/layer_9="throwing"
2d_physics/layer_10="obstacle"
-2d_physics/layer_11="npc"
+2d_physics/layer_11="hurtArea"
2d_physics/layer_14="ui_mouse"
[mono]
diff --git a/DungeonShooting_Godot/src/framework/activity/hurt/HurtArea.cs b/DungeonShooting_Godot/src/framework/activity/hurt/HurtArea.cs
index 8631faa0..7b8b7a00 100644
--- a/DungeonShooting_Godot/src/framework/activity/hurt/HurtArea.cs
+++ b/DungeonShooting_Godot/src/framework/activity/hurt/HurtArea.cs
@@ -1,17 +1,19 @@
using Godot;
+///
+/// 可被子弹击中的区域
+///
[Tool]
public partial class HurtArea : Area2D, IHurt
{
- public delegate void HurtDelegate(ActivityObject target, int damage, float angle);
+ ///
+ /// 所属角色
+ ///
+ public Role Master { get; private set; }
- public event HurtDelegate OnHurtEvent;
-
- public ActivityObject ActivityObject { get; private set; }
-
- public void InitActivityObject(ActivityObject activityObject)
+ public void InitRole(Role role)
{
- ActivityObject = activityObject;
+ Master = role;
}
public override void _Ready()
@@ -19,11 +21,23 @@ public partial class HurtArea : Area2D, IHurt
Monitoring = false;
}
+ public bool CanHurt(ActivityObject target)
+ {
+ //无敌状态
+ if (Master.Invincible)
+ {
+ return true;
+ }
+
+ if (target is Role role)
+ {
+ return Master.IsEnemy(role);
+ }
+ return true;
+ }
+
public void Hurt(ActivityObject target, int damage, float angle)
{
- if (OnHurtEvent != null)
- {
- OnHurtEvent(target, damage, angle);
- }
+ Master.CallDeferred(nameof(Master.HurtHandler), target, damage, angle);
}
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/activity/hurt/IHurt.cs b/DungeonShooting_Godot/src/framework/activity/hurt/IHurt.cs
index fd27abc8..3c3686d7 100644
--- a/DungeonShooting_Godot/src/framework/activity/hurt/IHurt.cs
+++ b/DungeonShooting_Godot/src/framework/activity/hurt/IHurt.cs
@@ -3,6 +3,12 @@ using Godot;
public interface IHurt
{
+ ///
+ /// 返回是否可以造成伤害
+ ///
+ /// 触发伤害的对象, 为 null 表示不存在对象或者对象已经被销毁
+ bool CanHurt(ActivityObject target);
+
///
/// 受到伤害
///
diff --git a/DungeonShooting_Godot/src/framework/common/NodeExtend.cs b/DungeonShooting_Godot/src/framework/common/NodeExtend.cs
index e04437d7..50d1ad91 100644
--- a/DungeonShooting_Godot/src/framework/common/NodeExtend.cs
+++ b/DungeonShooting_Godot/src/framework/common/NodeExtend.cs
@@ -21,7 +21,7 @@ public static class NodeExtend
if (hurt is HurtArea hurtArea)
{
- return hurtArea.ActivityObject;
+ return hurtArea.Master;
}
return null;
diff --git a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs
index 10f775df..3c9123dc 100644
--- a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs
+++ b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs
@@ -64,7 +64,7 @@ public partial class AffiliationArea : Area2D, IDestroy
Monitoring = true;
Monitorable = false;
CollisionLayer = PhysicsLayer.None;
- CollisionMask = PhysicsLayer.Prop | PhysicsLayer.Player | PhysicsLayer.Enemy | PhysicsLayer.Debris | PhysicsLayer.Throwing;
+ CollisionMask = PhysicsLayer.Prop | PhysicsLayer.Role | PhysicsLayer.Debris | PhysicsLayer.Throwing | PhysicsLayer.Obstacle;
BodyEntered += OnBodyEntered;
BodyExited += OnBodyExited;
diff --git a/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs
index 2a63757c..4e398aeb 100644
--- a/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs
+++ b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs
@@ -317,7 +317,7 @@ public class RoomPreinstall : IDestroy
foreach (var preloadData in _readyList)
{
//有敌人
- if (!hasEnemy && preloadData.ActivityObject.CollisionWithMask(PhysicsLayer.Enemy))
+ if (!hasEnemy && preloadData.ActivityObject is Role role && role.IsEnemyWithPlayer())
{
hasEnemy = true;
}
@@ -332,7 +332,7 @@ public class RoomPreinstall : IDestroy
if (!hasEnemy)
{
hasEnemy = RoomInfo.AffiliationArea.ExistIncludeItem(
- activityObject => activityObject.CollisionWithMask(PhysicsLayer.Enemy)
+ activityObject => activityObject is Role role && role.IsEnemyWithPlayer()
);
}
diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs
index 740846d2..34594325 100644
--- a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs
+++ b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs
@@ -474,7 +474,7 @@ public class RoomInfo : IDestroy
//房间内有敌人, 或者会刷新敌人才会关门
var hasEnemy = false;
- if (AffiliationArea.ExistEnterItem(activityObject => activityObject.CollisionWithMask(PhysicsLayer.Enemy))) //先判断房间里面是否有敌人
+ if (AffiliationArea.ExistEnterItem(activityObject => activityObject is Role role && role.IsEnemyWithPlayer())) //先判断房间里面是否有敌人
{
hasEnemy = true;
}
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs
index 17edff33..34cfd7f4 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs
@@ -164,7 +164,11 @@ public partial class Explode : Area2D, IPoolItem
if (len <= _hitRadius) //在伤害半径内
{
- hurt.Hurt(BulletData.TriggerRole.IsDestroyed ? null : BulletData.TriggerRole, _harm, angle);
+ var target = BulletData.TriggerRole.IsDestroyed ? null : BulletData.TriggerRole;
+ if (hurt.CanHurt(target))
+ {
+ hurt.Hurt(target, _harm, angle);
+ }
}
if (len <= _repelledRadius) //击退半径内
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs b/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs
index ebfb3f20..70e2787d 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs
@@ -224,7 +224,11 @@ public partial class Laser : Area2D, IBullet
}
//造成伤害
- hurt.Hurt(BulletData.TriggerRole.IsDestroyed ? null : BulletData.TriggerRole, BulletData.Harm, Rotation);
+ var target = BulletData.TriggerRole.IsDestroyed ? null : BulletData.TriggerRole;
+ if (hurt.CanHurt(target))
+ {
+ hurt.Hurt(target, BulletData.Harm, Rotation);
+ }
}
public long StartCoroutine(IEnumerator able)
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
index 5ce3d205..9b957100 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
@@ -204,7 +204,11 @@ public partial class Bullet : ActivityObject, IBullet
}
//造成伤害
- hurt.Hurt(BulletData.TriggerRole.IsDestroyed ? null : BulletData.TriggerRole, BulletData.Harm, Rotation);
+ var target = BulletData.TriggerRole.IsDestroyed ? null : BulletData.TriggerRole;
+ if (hurt.CanHurt(target))
+ {
+ hurt.Hurt(target, BulletData.Harm, Rotation);
+ }
//穿透次数
CurrentPenetration++;
diff --git a/DungeonShooting_Godot/src/game/activity/item/ObstacleObject.cs b/DungeonShooting_Godot/src/game/activity/item/ObstacleObject.cs
index 46ed5687..f9d0d165 100644
--- a/DungeonShooting_Godot/src/game/activity/item/ObstacleObject.cs
+++ b/DungeonShooting_Godot/src/game/activity/item/ObstacleObject.cs
@@ -7,6 +7,11 @@ using Godot;
[Tool]
public partial class ObstacleObject : ActivityObject, IHurt
{
+ public virtual bool CanHurt(ActivityObject target)
+ {
+ return true;
+ }
+
public virtual void Hurt(ActivityObject target, int damage, float angle)
{
}
diff --git a/DungeonShooting_Godot/src/game/activity/role/CampEnum.cs b/DungeonShooting_Godot/src/game/activity/role/CampEnum.cs
index 69540700..6ba2bb7d 100644
--- a/DungeonShooting_Godot/src/game/activity/role/CampEnum.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/CampEnum.cs
@@ -1,10 +1,28 @@
public enum CampEnum
{
- // 阵营1, 玩家
+ ///
+ /// 无阵营, 所有角色都视为敌人
+ ///
+ None,
+ ///
+ /// 和平阵营, 不会被攻击
+ ///
+ Peace,
+ ///
+ /// 阵营1, 玩家
+ ///
Camp1,
- // 阵营2, 敌人
+ ///
+ /// 阵营2, 敌人
+ ///
Camp2,
- // 阵营3, 中立单位
- Camp3
+ ///
+ /// 阵营3, 敌人2
+ ///
+ Camp3,
+ ///
+ /// 阵营4, 敌人3
+ ///
+ Camp4,
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/role/Role.cs b/DungeonShooting_Godot/src/game/activity/role/Role.cs
index 850cba3e..01ff94c1 100644
--- a/DungeonShooting_Godot/src/game/activity/role/Role.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/Role.cs
@@ -10,6 +10,11 @@ using Godot;
///
public abstract partial class Role : ActivityObject
{
+ ///
+ /// 攻击目标的碰撞器所属层级, 数据源自于:
+ ///
+ public const uint AttackLayer = PhysicsLayer.Wall | PhysicsLayer.Obstacle | PhysicsLayer.HurtArea;
+
///
/// 当前角色对其他角色造成伤害时对回调
/// 参数1为目标角色
@@ -27,11 +32,6 @@ public abstract partial class Role : ActivityObject
///
public RoleState RoleState { get; private set; }
- ///
- /// 默认攻击对象层级
- ///
- public const uint DefaultAttackLayer = PhysicsLayer.Player | PhysicsLayer.Enemy | PhysicsLayer.Obstacle;
-
///
/// 伤害区域
///
@@ -47,17 +47,7 @@ public abstract partial class Role : ActivityObject
///
/// 所属阵营
///
- public CampEnum Camp;
-
- ///
- /// 攻击目标的碰撞器所属层级, 数据源自于:
- ///
- public uint AttackLayer { get; set; } = PhysicsLayer.Wall | PhysicsLayer.Obstacle;
-
- ///
- /// 该角色敌对目标的碰撞器所属层级, 数据源自于:
- ///
- public uint EnemyLayer { get; set; } = PhysicsLayer.Enemy;
+ public CampEnum Camp { get; set; }
///
/// 携带的被动道具列表
@@ -282,20 +272,11 @@ public abstract partial class Role : ActivityObject
{
if (value) //无敌状态
{
- if (HurtArea != null)
- {
- HurtArea.CollisionLayer = _currentLayer;
- }
-
_flashingInvincibleTimer = -1;
_flashingInvincibleFlag = false;
}
else //正常状态
{
- if (HurtArea != null)
- {
- HurtArea.CollisionLayer = _currentLayer;
- }
SetBlendModulate(new Color(1, 1, 1, 1));
}
}
@@ -335,7 +316,6 @@ public abstract partial class Role : ActivityObject
private Vector2 _startScale;
//当前可互动的物体
private CheckInteractiveResult _currentResultData;
- private uint _currentLayer;
//闪烁计时器
private float _flashingInvincibleTimer = -1;
//闪烁状态
@@ -479,15 +459,7 @@ public abstract partial class Role : ActivityObject
_startScale = Scale;
- HurtArea.InitActivityObject(this);
- HurtArea.CollisionLayer = CollisionLayer;
- HurtArea.CollisionMask = PhysicsLayer.None;
- _currentLayer = HurtArea.CollisionLayer;
- //CollisionLayer = PhysicsLayer.None;
- HurtArea.OnHurtEvent += (target, damage, angle) =>
- {
- CallDeferred(nameof(HurtHandler), target, damage, angle);
- };
+ HurtArea.InitRole(this);
Face = FaceDirection.Right;
@@ -857,7 +829,7 @@ public abstract partial class Role : ActivityObject
/// 触发伤害的对象, 为 null 表示不存在对象或者对象已经被销毁
/// 伤害的量
/// 伤害角度(弧度制)
- protected virtual void HurtHandler(ActivityObject target, int damage, float angle)
+ public virtual void HurtHandler(ActivityObject target, int damage, float angle)
{
//受伤闪烁, 无敌状态
if (Invincible)
@@ -1016,6 +988,20 @@ public abstract partial class Role : ActivityObject
return this == World.Player;
}
+
+ ///
+ /// 返回指定角色是否是敌人
+ ///
+ public bool IsEnemy(Role other)
+ {
+ if (other.Camp == Camp || other.Camp == CampEnum.Peace || Camp == CampEnum.Peace)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
///
/// 是否是玩家的敌人
///
@@ -1025,7 +1011,7 @@ public abstract partial class Role : ActivityObject
{
return false;
}
- return CollisionWithMask(World.Player.EnemyLayer);
+ return IsEnemy(World.Player);
}
///
@@ -1437,8 +1423,11 @@ public abstract partial class Role : ActivityObject
var v2 = position.Normalized() * repel;
o.AddRepelForce(v2);
}
-
- hurt.Hurt(this, damage, (pos - GlobalPosition).Angle());
+
+ if (hurt.CanHurt(this))
+ {
+ hurt.Hurt(this, damage, (pos - GlobalPosition).Angle());
+ }
}
protected override void OnDestroy()
diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
index 14c0bc57..998ecfd8 100644
--- a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
@@ -63,9 +63,6 @@ public partial class Enemy : AiRole
public override void OnInit()
{
base.OnInit();
-
- AttackLayer = PhysicsLayer.Obstacle | PhysicsLayer.Player;
- EnemyLayer = PhysicsLayer.Player;
Camp = CampEnum.Camp2;
RoleState.MoveSpeed = 20;
diff --git a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs
index 342d205d..33e39caf 100644
--- a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs
@@ -37,8 +37,6 @@ public partial class Player : Role
IsAi = false;
StateController = AddComponent>();
- AttackLayer = PhysicsLayer.Obstacle | PhysicsLayer.Enemy;
- EnemyLayer = EnemyLayer = PhysicsLayer.Enemy;
Camp = CampEnum.Camp1;
MaxHp = 6;
@@ -223,10 +221,14 @@ public partial class Player : Role
}
else if (Input.IsKeyPressed(Key.O)) //测试用, 消灭房间内所有敌人
{
- var enemyList = AffiliationArea.FindIncludeItems(o => o.CollisionWithMask(PhysicsLayer.Enemy));
+ var enemyList = AffiliationArea.FindIncludeItems(o => o is Role role && role.IsEnemyWithPlayer());
foreach (var enemy in enemyList)
{
- ((Enemy)enemy).HurtArea.Hurt(this, 1000, 0);
+ var hurt = ((Enemy)enemy).HurtArea;
+ if (hurt.CanHurt(this))
+ {
+ hurt.Hurt(this, 1000, 0);
+ }
}
}
// //测试用
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
index edb144a3..065bced1 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
@@ -28,9 +28,9 @@ public abstract partial class Weapon : ActivityObject, IPackageItem
private ExcelConfig.WeaponBase _aiWeaponAttribute;
///
- /// 武器攻击的目标阵营
+ /// 攻击目标层级
///
- public CampEnum TargetCamp { get; set; }
+ public uint AttackLayer => Role.AttackLayer;
public Role Master { get; set; }
@@ -149,11 +149,6 @@ public abstract partial class Weapon : ActivityObject, IPackageItem
///
public Role TriggerRole { get; private set; }
- ///
- /// 上一次触发改武器开火的触发开火攻击的层级, 数据源自于:
- ///
- public long TriggerRoleAttackLayer { get; private set; }
-
///
/// 武器当前射速
///
@@ -850,13 +845,11 @@ public abstract partial class Weapon : ActivityObject, IPackageItem
if (triggerRole != null)
{
TriggerRole = triggerRole;
- TriggerRoleAttackLayer = triggerRole.AttackLayer;
SetCurrentWeaponAttribute(triggerRole.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute);
}
else if (Master != null)
{
TriggerRole = Master;
- TriggerRoleAttackLayer = Master.AttackLayer;
SetCurrentWeaponAttribute(Master.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute);
}
@@ -1275,19 +1268,6 @@ public abstract partial class Weapon : ActivityObject, IPackageItem
return AiUseAttribute;
}
- ///
- /// 获取武器攻击的目标层级
- ///
- ///
- public uint GetAttackLayer()
- {
- if (TriggerRoleAttackLayer > 0)
- {
- return (uint)TriggerRoleAttackLayer;
- }
- return Master != null ? Master.AttackLayer : Role.DefaultAttackLayer;
- }
-
///
/// 返回弹药是否到达上限
///
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
index 11c2d305..11f51c70 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
@@ -75,7 +75,7 @@ public partial class Knife : Weapon
{
Debug.Log("近战武器攻击! 蓄力时长: " + GetTriggerChargeTime() + ", 扳机按下时长: " + GetTriggerDownTime());
//更新碰撞层级
- _hitArea.CollisionMask = GetAttackLayer() | PhysicsLayer.Bullet;
+ _hitArea.CollisionMask = AttackLayer | PhysicsLayer.Bullet;
//启用碰撞
_hitArea.Monitoring = true;
_attackIndex = 0;
@@ -143,7 +143,6 @@ public partial class Knife : Weapon
}
bullet.MoveController.ScaleAllVelocity(scale);
bullet.Rotation += Mathf.Pi;
- bullet.AttackLayer = TriggerRole.AttackLayer;
bullet.RefreshBulletColor(false);
}
}
@@ -195,6 +194,9 @@ public partial class Knife : Weapon
}
//造成伤害
- hurt.Hurt(TriggerRole, damage, (hurt.GetPosition() - globalPosition).Angle());
+ if (hurt.CanHurt(TriggerRole))
+ {
+ hurt.Hurt(TriggerRole, damage, (hurt.GetPosition() - globalPosition).Angle());
+ }
}
}
diff --git a/DungeonShooting_Godot/src/game/data/property/PhysicsLayer.cs b/DungeonShooting_Godot/src/game/data/property/PhysicsLayer.cs
index 01942693..cf6f7f81 100644
--- a/DungeonShooting_Godot/src/game/data/property/PhysicsLayer.cs
+++ b/DungeonShooting_Godot/src/game/data/property/PhysicsLayer.cs
@@ -24,9 +24,9 @@ public class PhysicsLayer
///
public const uint Player = 0b1000;
///
- /// 敌人
+ /// 角色基类
///
- public const uint Enemy = 0b10000;
+ public const uint Role = 0b10000;
///
/// 归属区域判断层级
///
@@ -48,7 +48,7 @@ public class PhysicsLayer
///
public const uint Obstacle = 0b1000000000;
///
- /// npc
+ /// 可被子弹击中的区域
///
- public const uint Npc = 0b10000000000;
+ public const uint HurtArea = 0b10000000000;
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/manager/FireManager.cs b/DungeonShooting_Godot/src/game/manager/FireManager.cs
index c7b436b9..a941ca20 100644
--- a/DungeonShooting_Godot/src/game/manager/FireManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/FireManager.cs
@@ -97,11 +97,11 @@ public static class FireManager
{
if (bullet.Type == 1) //实体子弹
{
- return ShootSolidBullet(CreateSolidBulletData(weapon, fireRotation, bullet), weapon.GetAttackLayer());
+ return ShootSolidBullet(CreateSolidBulletData(weapon, fireRotation, bullet), weapon.AttackLayer);
}
else if (bullet.Type == 2) //激光子弹
{
- return ShootLaser(CreateLaserData(weapon, fireRotation, bullet), weapon.GetAttackLayer());
+ return ShootLaser(CreateLaserData(weapon, fireRotation, bullet), weapon.AttackLayer);
}
else
{
@@ -118,7 +118,7 @@ public static class FireManager
{
if (bullet.Type == 1) //实体子弹
{
- return ShootSolidBullet(CreateSolidBulletData(trigger, fireRotation, bullet), trigger.AttackLayer);
+ return ShootSolidBullet(CreateSolidBulletData(trigger, fireRotation, bullet), Role.AttackLayer);
}
return null;
diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs
index ab52b27a..7878e521 100644
--- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs
+++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs
@@ -904,7 +904,7 @@ public partial class DungeonManager : Node2D
{
//房间内是否有存活的敌人
var flag = ActiveAffiliationArea.ExistEnterItem(
- activityObject => activityObject.CollisionWithMask(PhysicsLayer.Enemy)
+ activityObject => activityObject is Role role && role.IsEnemyWithPlayer()
);
//Debug.Log("当前房间存活数量: " + count);
if (!flag)
diff --git a/DungeonShooting_Godot/src/game/World.cs b/DungeonShooting_Godot/src/game/world/World.cs
similarity index 100%
rename from DungeonShooting_Godot/src/game/World.cs
rename to DungeonShooting_Godot/src/game/world/World.cs