diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/HighSpeedBullet.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/HighSpeedBullet.tscn
deleted file mode 100644
index 502e3f3..0000000
--- a/DungeonShooting_Godot/prefab/weapon/bullet/HighSpeedBullet.tscn
+++ /dev/null
@@ -1,27 +0,0 @@
-[gd_scene load_steps=5 format=2]
-
-[ext_resource path="res://src/game/item/weapon/bullet/HighSpeedBullet.cs" type="Script" id=1]
-[ext_resource path="res://prefab/effect/Hit.tscn" type="PackedScene" id=2]
-
-[sub_resource type="Curve" id=1]
-_data = [ Vector2( 0, 0.781588 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
-
-[sub_resource type="Gradient" id=2]
-colors = PoolColorArray( 1, 1, 1, 0, 1, 1, 1, 0.705882 )
-
-[node name="HighSpeedBullet" type="Node2D"]
-script = ExtResource( 1 )
-Hit = ExtResource( 2 )
-
-[node name="Line" type="Line2D" parent="."]
-modulate = Color( 1, 0.937255, 0.843137, 1 )
-points = PoolVector2Array( 0, 0, 0, 10 )
-width = 1.0
-width_curve = SubResource( 1 )
-default_color = Color( 1, 1, 1, 1 )
-gradient = SubResource( 2 )
-begin_cap_mode = 2
-end_cap_mode = 2
-
-[node name="RayCast2D" type="RayCast2D" parent="."]
-visible = false
diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/OrdinaryBullets.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/OrdinaryBullets.tscn
deleted file mode 100644
index 2071ef3..0000000
--- a/DungeonShooting_Godot/prefab/weapon/bullet/OrdinaryBullets.tscn
+++ /dev/null
@@ -1,19 +0,0 @@
-[gd_scene load_steps=4 format=2]
-
-[ext_resource path="res://src/game/item/weapon/bullet/OrdinaryBullets.cs" type="Script" id=1]
-[ext_resource path="res://resource/sprite/bullet/bullet.png" type="Texture" id=2]
-[ext_resource path="res://prefab/effect/Hit.tscn" type="PackedScene" id=3]
-
-[node name="OrdinaryBullets" type="Node2D"]
-script = ExtResource( 1 )
-Hit = ExtResource( 3 )
-
-[node name="RayCast2D" type="RayCast2D" parent="."]
-enabled = true
-cast_to = Vector2( 18, 0 )
-collision_mask = 17
-
-[node name="Bullet" type="Sprite" parent="."]
-position = Vector2( 0.5, 0 )
-texture = ExtResource( 2 )
-offset = Vector2( -7.5, 0 )
diff --git a/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs b/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs
index c6cad38..4adc29e 100644
--- a/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs
+++ b/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs
@@ -12,7 +12,7 @@
///
/// 武器 Prefab, 必须继承场景 "res://prefab/weapon/Weapon.tscn"
///
- public string WeaponPrefab = "res://prefab/weapon/Weapon.tscn";
+ public string WeaponPrefab = ResourcePath.prefab_weapon_Weapon_tscn;
///
/// 武器类型
///
@@ -20,7 +20,7 @@
///
/// 武器的图片
///
- public string Sprite = "res://resource/sprite/gun/gun1.png";
+ public string Sprite = ResourcePath.resource_sprite_gun_gun1_png;
///
/// 是否连续发射, 如果为false, 则每次发射都需要扣动扳机
///
diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs
index b4736f1..bae4c17 100644
--- a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs
+++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs
@@ -114,7 +114,7 @@
MathUtils.RandRange(Attribute.MinDistance, Attribute.MaxDistance),
FirePoint.GlobalPosition,
fireRotation,
- PhysicsLayer.Wall | PhysicsLayer.Enemy
+ Master != null ? Master.AttackLayer : Role.DefaultAttackLayer
);
bullet.PutDown();
}
diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs
index 6a4d871..c6817c5 100644
--- a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs
+++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs
@@ -9,7 +9,7 @@
public ShotgunAttribute()
{
Name = "霰弹枪";
- Sprite = "res://resource/sprite/gun/gun2.png";
+ Sprite = ResourcePath.resource_sprite_gun_gun2_png;
Weight = 40;
CenterPosition = new Vector2(0.4f, -2.6f);
StartFiringSpeed = 120;
@@ -51,7 +51,7 @@
public Shotgun(string id, WeaponAttribute attribute) : base(id, attribute)
{
- ShellPack = ResourceManager.Load("res://prefab/weapon/shell/ShellCase.tscn");
+ ShellPack = ResourceManager.Load(ResourcePath.prefab_weapon_shell_ShellCase_tscn);
}
protected override void OnFire()
@@ -83,7 +83,7 @@
MathUtils.RandRange(Attribute.MinDistance, Attribute.MaxDistance),
FirePoint.GlobalPosition,
fireRotation + MathUtils.RandRange(-20 / 180f * Mathf.Pi, 20 / 180f * Mathf.Pi),
- PhysicsLayer.Wall | PhysicsLayer.Enemy
+ Master != null ? Master.AttackLayer : Role.DefaultAttackLayer
);
bullet.PutDown();
}
diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
index 9969786..015826b 100644
--- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
+++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
@@ -112,5 +112,4 @@
public const string default_env_tres = "res://default_env.tres";
public const string icon_png = "res://icon.png";
public const string SourceHanSerifCNSemiBold_otf = "res://SourceHanSerifCN-SemiBold.otf";
- public const string testaaa_txt = "res://testaaa.txt";
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/role/Enemy.cs b/DungeonShooting_Godot/src/game/role/Enemy.cs
index 67c33f7..51b25cf 100644
--- a/DungeonShooting_Godot/src/game/role/Enemy.cs
+++ b/DungeonShooting_Godot/src/game/role/Enemy.cs
@@ -3,6 +3,7 @@
{
public Enemy() : base(ResourcePath.prefab_role_Enemy_tscn)
{
+ AttackLayer = PhysicsLayer.Wall | PhysicsLayer.Props | PhysicsLayer.Player;
Camp = CampEnum.Camp2;
}
}
diff --git a/DungeonShooting_Godot/src/game/role/Player.cs b/DungeonShooting_Godot/src/game/role/Player.cs
index c3998a2..6a24f6e 100644
--- a/DungeonShooting_Godot/src/game/role/Player.cs
+++ b/DungeonShooting_Godot/src/game/role/Player.cs
@@ -50,6 +50,7 @@
public Player(): base(ResourcePath.prefab_role_Player_tscn)
{
+ AttackLayer = PhysicsLayer.Wall | PhysicsLayer.Props | PhysicsLayer.Enemy;
Camp = CampEnum.Camp1;
}
diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs
index e574d7b..92c3133 100644
--- a/DungeonShooting_Godot/src/game/role/Role.cs
+++ b/DungeonShooting_Godot/src/game/role/Role.cs
@@ -7,6 +7,11 @@
public abstract class Role : ActivityObject
{
///
+ /// 默认攻击对象层级
+ ///
+ public const uint DefaultAttackLayer = PhysicsLayer.Player | PhysicsLayer.Enemy | PhysicsLayer.Wall | PhysicsLayer.Props;
+
+ ///
/// 动画播放器
///
public AnimationPlayer AnimationPlayer { get; private set; }
@@ -27,6 +32,11 @@
public CampEnum Camp;
///
+ /// 攻击目标的碰撞器所属层级, 数据源自于: PhysicsLayer
+ ///
+ public uint AttackLayer { get; set; } = PhysicsLayer.Wall;
+
+ ///
/// 携带的道具包裹
///
public List