diff --git a/DungeonShooting_Godot/prefab/role/Role.tscn b/DungeonShooting_Godot/prefab/role/Role.tscn index 0b11811..8f99845 100644 --- a/DungeonShooting_Godot/prefab/role/Role.tscn +++ b/DungeonShooting_Godot/prefab/role/Role.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3] +[gd_scene load_steps=9 format=3 uid="uid://cyrcv2jdgr8cf"] [ext_resource type="Script" path="res://src/framework/activity/ActivityObjectTemplate.cs" id="1_hm41b"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_q6jwp"] @@ -63,5 +63,5 @@ shape = SubResource("RectangleShape2D_n68nu") [node name="MountPoint" type="Marker2D" parent="."] -position = Vector2(2, -4) +position = Vector2(4, -4) script = ExtResource("4") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon.tscn index 15cd7f8..f2e3b95 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon.tscn @@ -16,7 +16,7 @@ shader_parameter/schedule = 0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] -size = Vector2(15.6, 7) +size = Vector2(19.5, 8.75) [sub_resource type="Animation" id="Animation_x136i"] length = 0.001 @@ -67,16 +67,15 @@ [node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] material = SubResource("ShaderMaterial_o36tv") position = Vector2(0.4, -2.6) -scale = Vector2(0.8, 0.8) [node name="OriginPoint" type="Marker2D" parent="."] -position = Vector2(-3.6, -1.1) +position = Vector2(-3, 0) [node name="ShellPoint" type="Marker2D" parent="."] -position = Vector2(-2.6, -2.6) +position = Vector2(0, -2) [node name="FirePoint" type="Marker2D" parent="."] -position = Vector2(7.4, -1.1) +position = Vector2(10, -1) [node name="Collision" type="CollisionShape2D" parent="."] position = Vector2(0.6, 0.2) diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/Bullet.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/Bullet.tscn deleted file mode 100644 index e0b78f3..0000000 --- a/DungeonShooting_Godot/prefab/weapon/bullet/Bullet.tscn +++ /dev/null @@ -1,64 +0,0 @@ -[gd_scene load_steps=9 format=3] - -[ext_resource type="Script" path="res://src/framework/activity/ActivityObjectTemplate.cs" id="1_nwypj"] -[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2"] -[ext_resource type="Texture2D" uid="uid://bu0b11hiuecxy" path="res://resource/sprite/bullet/bullet.png" id="3"] - - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_5a4f2"] -resource_local_to_scene = true -shader = ExtResource("2") -shader_parameter/blend = Color(0, 0, 0, 0.470588) -shader_parameter/schedule = 1 - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_o0655"] -resource_local_to_scene = true -shader = ExtResource("2") -shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 0 - -[sub_resource type="SpriteFrames" id="SpriteFrames_5wvmf"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": ExtResource("3") -}], -"loop": true, -"name": &"default", -"speed": 5.0 -}] - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_c0onq"] -size = Vector2(44.72, 12) - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_lcqb8"] -size = Vector2(11, 4) - -[node name="Bullet" type="Node"] -script = ExtResource("1_nwypj") -collision_layer = 2 -collision_mask = 1 - -[node name="ShadowSprite" type="Sprite2D" parent="."] -z_index = -1 -material = SubResource("ShaderMaterial_5a4f2") - -[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] -modulate = Color(1.8, 1.8, 1.8, 1) -material = SubResource("ShaderMaterial_o0655") -sprite_frames = SubResource("SpriteFrames_5wvmf") - -[node name="CollisionArea" type="Area2D" parent="."] -visible = false -collision_layer = 0 -collision_mask = 0 -monitorable = false - -[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"] -position = Vector2(2.93353, 0) -scale = Vector2(0.226586, 0.333333) -shape = SubResource("RectangleShape2D_c0onq") - -[node name="Collision" type="CollisionShape2D" parent="."] -position = Vector2(2.5, 0) -shape = SubResource("RectangleShape2D_lcqb8") diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/Bullet1.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/Bullet1.tscn new file mode 100644 index 0000000..e0b78f3 --- /dev/null +++ b/DungeonShooting_Godot/prefab/weapon/bullet/Bullet1.tscn @@ -0,0 +1,64 @@ +[gd_scene load_steps=9 format=3] + +[ext_resource type="Script" path="res://src/framework/activity/ActivityObjectTemplate.cs" id="1_nwypj"] +[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2"] +[ext_resource type="Texture2D" uid="uid://bu0b11hiuecxy" path="res://resource/sprite/bullet/bullet.png" id="3"] + + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_5a4f2"] +resource_local_to_scene = true +shader = ExtResource("2") +shader_parameter/blend = Color(0, 0, 0, 0.470588) +shader_parameter/schedule = 1 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_o0655"] +resource_local_to_scene = true +shader = ExtResource("2") +shader_parameter/blend = Color(1, 1, 1, 1) +shader_parameter/schedule = 0 + +[sub_resource type="SpriteFrames" id="SpriteFrames_5wvmf"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("3") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_c0onq"] +size = Vector2(44.72, 12) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_lcqb8"] +size = Vector2(11, 4) + +[node name="Bullet" type="Node"] +script = ExtResource("1_nwypj") +collision_layer = 2 +collision_mask = 1 + +[node name="ShadowSprite" type="Sprite2D" parent="."] +z_index = -1 +material = SubResource("ShaderMaterial_5a4f2") + +[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] +modulate = Color(1.8, 1.8, 1.8, 1) +material = SubResource("ShaderMaterial_o0655") +sprite_frames = SubResource("SpriteFrames_5wvmf") + +[node name="CollisionArea" type="Area2D" parent="."] +visible = false +collision_layer = 0 +collision_mask = 0 +monitorable = false + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"] +position = Vector2(2.93353, 0) +scale = Vector2(0.226586, 0.333333) +shape = SubResource("RectangleShape2D_c0onq") + +[node name="Collision" type="CollisionShape2D" parent="."] +position = Vector2(2.5, 0) +shape = SubResource("RectangleShape2D_lcqb8") diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/Bullet2.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/Bullet2.tscn new file mode 100644 index 0000000..66f2c73 --- /dev/null +++ b/DungeonShooting_Godot/prefab/weapon/bullet/Bullet2.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=9 format=3 uid="uid://bqkj0rn72ppge"] + +[ext_resource type="Script" path="res://src/framework/activity/ActivityObjectTemplate.cs" id="1_nwypj"] +[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2"] +[ext_resource type="Texture2D" uid="uid://ctsvj4y1t538u" path="res://resource/sprite/bullet/bullet3.png" id="3_l53o1"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_5a4f2"] +resource_local_to_scene = true +shader = ExtResource("2") +shader_parameter/blend = Color(0, 0, 0, 0.470588) +shader_parameter/schedule = 1 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_o0655"] +resource_local_to_scene = true +shader = ExtResource("2") +shader_parameter/blend = Color(1, 1, 1, 1) +shader_parameter/schedule = 0 + +[sub_resource type="SpriteFrames" id="SpriteFrames_5wvmf"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("3_l53o1") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_c0onq"] +size = Vector2(44.72, 12) + +[sub_resource type="CircleShape2D" id="CircleShape2D_e2yn3"] +radius = 3.0 + +[node name="Bullet" type="Node"] +script = ExtResource("1_nwypj") +collision_layer = 2 +collision_mask = 1 + +[node name="ShadowSprite" type="Sprite2D" parent="."] +z_index = -1 +material = SubResource("ShaderMaterial_5a4f2") + +[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] +modulate = Color(1.8, 1.8, 1.8, 1) +material = SubResource("ShaderMaterial_o0655") +sprite_frames = SubResource("SpriteFrames_5wvmf") + +[node name="CollisionArea" type="Area2D" parent="."] +visible = false +collision_layer = 0 +collision_mask = 0 +monitorable = false + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"] +position = Vector2(2.93353, 0) +scale = Vector2(0.226586, 0.333333) +shape = SubResource("RectangleShape2D_c0onq") + +[node name="Collision" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_e2yn3") diff --git a/DungeonShooting_Godot/resource/sprite/bullet/bullet3.png b/DungeonShooting_Godot/resource/sprite/bullet/bullet3.png new file mode 100644 index 0000000..ce0577e --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/bullet/bullet3.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/bullet/bullet3.png.import b/DungeonShooting_Godot/resource/sprite/bullet/bullet3.png.import new file mode 100644 index 0000000..765caff --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/bullet/bullet3.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ctsvj4y1t538u" +path="res://.godot/imported/bullet3.png-da66182a32c8e83b9b95206d8e836cf2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/bullet/bullet3.png" +dest_files=["res://.godot/imported/bullet3.png-da66182a32c8e83b9b95206d8e836cf2.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/CheckInteractiveResult.cs b/DungeonShooting_Godot/src/framework/activity/CheckInteractiveResult.cs new file mode 100644 index 0000000..eb8676b --- /dev/null +++ b/DungeonShooting_Godot/src/framework/activity/CheckInteractiveResult.cs @@ -0,0 +1,28 @@ + +/// +/// 检测互动返回的数据集 +/// +public class CheckInteractiveResult +{ + /// + /// 互动物体 + /// + public ActivityObject Target; + /// + /// 是否可以互动 + /// + public bool CanInteractive; + /// + /// 互动提示信息 + /// + public string Message; + /// + /// 互动提示显示的图标 + /// + public string ShowIcon; + + public CheckInteractiveResult(ActivityObject target) + { + Target = target; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs b/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs index e60e60c..b313c36 100644 --- a/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs @@ -94,10 +94,6 @@ GD.Print("扫描排除路径: " + path); return; } - else - { - GD.Print("path: " + path); - } } var fileInfos = directoryInfos.GetFiles(); diff --git a/DungeonShooting_Godot/src/game/item/CheckInteractiveResult.cs b/DungeonShooting_Godot/src/game/item/CheckInteractiveResult.cs deleted file mode 100644 index eb8676b..0000000 --- a/DungeonShooting_Godot/src/game/item/CheckInteractiveResult.cs +++ /dev/null @@ -1,28 +0,0 @@ - -/// -/// 检测互动返回的数据集 -/// -public class CheckInteractiveResult -{ - /// - /// 互动物体 - /// - public ActivityObject Target; - /// - /// 是否可以互动 - /// - public bool CanInteractive; - /// - /// 互动提示信息 - /// - public string Message; - /// - /// 互动提示显示的图标 - /// - public string ShowIcon; - - public CheckInteractiveResult(ActivityObject target) - { - Target = target; - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/item/bullet/Bullet.cs new file mode 100644 index 0000000..f015411 --- /dev/null +++ b/DungeonShooting_Godot/src/game/item/bullet/Bullet.cs @@ -0,0 +1,97 @@ +using Godot; + +/// +/// 子弹类 +/// +[RegisterActivity(ActivityIdPrefix.Bullet + "0001", ResourcePath.prefab_weapon_bullet_Bullet1_tscn)] +[RegisterActivity(ActivityIdPrefix.Bullet + "0002", ResourcePath.prefab_weapon_bullet_Bullet2_tscn)] +public partial class Bullet : ActivityObject +{ + /// + /// 碰撞区域 + /// + public Area2D CollisionArea { get; private set; } + + /// + /// 发射该子弹的武器 + /// + public Weapon Weapon { get; private set; } + + // 最大飞行距离 + private float MaxDistance; + + // 子弹飞行速度 + private float FlySpeed; + + //当前子弹已经飞行的距离 + private float CurrFlyDistance = 0; + + public void Init(Weapon weapon, float speed, float maxDistance, Vector2 position, float rotation, uint targetLayer) + { + Weapon = weapon; + CollisionArea = GetNode("CollisionArea"); + CollisionArea.CollisionMask = targetLayer; + CollisionArea.AreaEntered += OnArea2dEntered; + + //只有玩家使用该武器才能获得正常速度的子弹 + if (weapon.Master is Player) + { + FlySpeed = speed; + } + else + { + FlySpeed = speed * weapon.Attribute.AiBulletSpeedScale; + } + MaxDistance = maxDistance; + Position = position; + Rotation = rotation; + ShadowOffset = new Vector2(0, 5); + + BasisVelocity = new Vector2(FlySpeed, 0).Rotated(Rotation); + } + + protected override void PhysicsProcessOver(float delta) + { + //移动 + var lastSlideCollision = GetLastSlideCollision(); + //撞到墙 + if (lastSlideCollision != null) + { + //创建粒子特效 + var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_BulletSmoke_tscn); + var smoke = packedScene.Instantiate(); + smoke.GlobalPosition = lastSlideCollision.GetPosition(); + smoke.GlobalRotation = lastSlideCollision.GetNormal().Angle(); + smoke.AddToActivityRoot(RoomLayerEnum.YSortLayer); + + Destroy(); + return; + } + //距离太大, 自动销毁 + CurrFlyDistance += FlySpeed * delta; + if (CurrFlyDistance >= MaxDistance) + { + var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_BulletDisappear_tscn); + var node = packedScene.Instantiate(); + node.GlobalPosition = GlobalPosition; + node.AddToActivityRoot(RoomLayerEnum.YSortLayer); + + Destroy(); + } + } + + private void OnArea2dEntered(Area2D other) + { + var role = other.AsActivityObject(); + if (role != null) + { + var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_BulletDisappear_tscn); + var node = packedScene.Instantiate(); + node.GlobalPosition = GlobalPosition; + node.AddToActivityRoot(RoomLayerEnum.YSortLayer); + + role.CallDeferred(nameof(Role.Hurt), 4, Rotation); + Destroy(); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/bullet/BulletAttribute.cs b/DungeonShooting_Godot/src/game/item/bullet/BulletAttribute.cs new file mode 100644 index 0000000..aa30af1 --- /dev/null +++ b/DungeonShooting_Godot/src/game/item/bullet/BulletAttribute.cs @@ -0,0 +1,5 @@ + +public class BulletAttribute +{ + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/bullet/RegisterBullet.cs b/DungeonShooting_Godot/src/game/item/bullet/RegisterBullet.cs new file mode 100644 index 0000000..7357cad --- /dev/null +++ b/DungeonShooting_Godot/src/game/item/bullet/RegisterBullet.cs @@ -0,0 +1,7 @@ + +public class RegisterBullet : RegisterActivity +{ + public RegisterBullet(string itemId, string prefabPath) : base(itemId, prefabPath) + { + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/shell/ShellCase.cs b/DungeonShooting_Godot/src/game/item/shell/ShellCase.cs new file mode 100644 index 0000000..1966222 --- /dev/null +++ b/DungeonShooting_Godot/src/game/item/shell/ShellCase.cs @@ -0,0 +1,22 @@ + +using Godot; + +/// +/// 弹壳类 +/// +[RegisterActivity(ActivityIdPrefix.Shell + "0001", ResourcePath.prefab_weapon_shell_ShellCase_tscn)] +public partial class ShellCase : ActivityObject +{ + public override void OnInit() + { + base.OnInit(); + ShadowOffset = new Vector2(0, 1); + ThrowCollisionSize = new Vector2(5, 5); + } + + protected override void OnThrowOver() + { + EnableBehavior = false; + Collision.QueueFree(); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs b/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs index a37809a..0b65411 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/WeaponAttribute.cs @@ -166,6 +166,10 @@ /// 开火后武器口角度恢复速度倍数 /// public float UpliftAngleRestore = 1f; + /// + /// 默认射出的子弹 + /// + public string BulletId = ActivityIdPrefix.Bullet + "0001"; /// /// 克隆一份新的属性配置 @@ -225,6 +229,7 @@ attr.DefaultAngle = DefaultAngle; attr.UpliftAngleRestore = UpliftAngleRestore; attr.AiTargetLockingTime = AiTargetLockingTime; + attr.BulletId = BulletId; return attr; } diff --git a/DungeonShooting_Godot/src/game/item/weapon/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/item/weapon/bullet/Bullet.cs deleted file mode 100644 index f165172..0000000 --- a/DungeonShooting_Godot/src/game/item/weapon/bullet/Bullet.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Godot; - -/// -/// 子弹类 -/// -[RegisterActivity(ActivityIdPrefix.Bullet + "0001", ResourcePath.prefab_weapon_bullet_Bullet_tscn)] -public partial class Bullet : ActivityObject -{ - /// - /// 碰撞区域 - /// - public Area2D CollisionArea { get; private set; } - - /// - /// 发射该子弹的武器 - /// - public Weapon Weapon { get; private set; } - - // 最大飞行距离 - private float MaxDistance; - - // 子弹飞行速度 - private float FlySpeed; - - //当前子弹已经飞行的距离 - private float CurrFlyDistance = 0; - - public void Init(Weapon weapon, float speed, float maxDistance, Vector2 position, float rotation, uint targetLayer) - { - Weapon = weapon; - CollisionArea = GetNode("CollisionArea"); - CollisionArea.CollisionMask = targetLayer; - CollisionArea.AreaEntered += OnArea2dEntered; - - //只有玩家使用该武器才能获得正常速度的子弹 - if (weapon.Master is Player) - { - FlySpeed = speed; - } - else - { - FlySpeed = speed * weapon.Attribute.AiBulletSpeedScale; - } - MaxDistance = maxDistance; - Position = position; - Rotation = rotation; - ShadowOffset = new Vector2(0, 5); - - BasisVelocity = new Vector2(FlySpeed, 0).Rotated(Rotation); - } - - protected override void PhysicsProcessOver(float delta) - { - //移动 - var lastSlideCollision = GetLastSlideCollision(); - //撞到墙 - if (lastSlideCollision != null) - { - //创建粒子特效 - var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_BulletSmoke_tscn); - var smoke = packedScene.Instantiate(); - smoke.GlobalPosition = lastSlideCollision.GetPosition(); - smoke.GlobalRotation = lastSlideCollision.GetNormal().Angle(); - smoke.AddToActivityRoot(RoomLayerEnum.YSortLayer); - - Destroy(); - return; - } - //距离太大, 自动销毁 - CurrFlyDistance += FlySpeed * delta; - if (CurrFlyDistance >= MaxDistance) - { - var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_BulletDisappear_tscn); - var node = packedScene.Instantiate(); - node.GlobalPosition = GlobalPosition; - node.AddToActivityRoot(RoomLayerEnum.YSortLayer); - - Destroy(); - } - } - - private void OnArea2dEntered(Area2D other) - { - var role = other.AsActivityObject(); - if (role != null) - { - var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_BulletDisappear_tscn); - var node = packedScene.Instantiate(); - node.GlobalPosition = GlobalPosition; - node.AddToActivityRoot(RoomLayerEnum.YSortLayer); - - role.CallDeferred(nameof(Role.Hurt), 4, Rotation); - Destroy(); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs index f7e6c32..a78e169 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs @@ -40,7 +40,7 @@ //抬起角度 UpliftAngle = 10; //开火位置 - FirePosition = new Vector2(16, 2); + FirePosition = new Vector2(20F, 2.5F); AiUseAttribute = Clone(); AiUseAttribute.AiTargetLockingTime = 0.5f; @@ -88,7 +88,7 @@ //抬起角度 UpliftAngle = 30; //开火位置 - FirePosition = new Vector2(10, 2); + FirePosition = new Vector2(12.5F, 2.5F); AiUseAttribute = Clone(); AiUseAttribute.AiTargetLockingTime = 1f; @@ -129,8 +129,7 @@ protected override void OnShoot(float fireRotation) { //创建子弹 - const string bulletId = ActivityIdPrefix.Bullet + "0001"; - var bullet = ActivityObject.Create(bulletId); + var bullet = ActivityObject.Create(Attribute.BulletId); bullet.Init( this, 350, diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs index 0c66caa..f5362d2 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs @@ -41,7 +41,8 @@ MaxBacklash = 6; MinBacklash = 5; //开火位置 - FirePosition = new Vector2(18, 4); + FirePosition = new Vector2(22.5F, 5F); + BulletId = ActivityIdPrefix.Bullet + "0002"; AiUseAttribute = Clone(); AiUseAttribute.AiTargetLockingTime = 0.2f; @@ -93,8 +94,7 @@ protected override void OnShoot(float fireRotation) { //创建子弹 - const string bulletId = ActivityIdPrefix.Bullet + "0001"; - var bullet = ActivityObject.Create(bulletId); + var bullet = ActivityObject.Create(Attribute.BulletId); bullet.Init( this, Utils.RandomRangeInt(280, 380), diff --git a/DungeonShooting_Godot/src/game/item/weapon/shell/ShellCase.cs b/DungeonShooting_Godot/src/game/item/weapon/shell/ShellCase.cs deleted file mode 100644 index 1966222..0000000 --- a/DungeonShooting_Godot/src/game/item/weapon/shell/ShellCase.cs +++ /dev/null @@ -1,22 +0,0 @@ - -using Godot; - -/// -/// 弹壳类 -/// -[RegisterActivity(ActivityIdPrefix.Shell + "0001", ResourcePath.prefab_weapon_shell_ShellCase_tscn)] -public partial class ShellCase : ActivityObject -{ - public override void OnInit() - { - base.OnInit(); - ShadowOffset = new Vector2(0, 1); - ThrowCollisionSize = new Vector2(5, 5); - } - - protected override void OnThrowOver() - { - EnableBehavior = false; - Collision.QueueFree(); - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 113bc76..00bb073 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -33,7 +33,8 @@ public const string prefab_ui_Settlement_tscn = "res://prefab/ui/Settlement.tscn"; public const string prefab_weapon_Knife_tscn = "res://prefab/weapon/Knife.tscn"; public const string prefab_weapon_Weapon_tscn = "res://prefab/weapon/Weapon.tscn"; - public const string prefab_weapon_bullet_Bullet_tscn = "res://prefab/weapon/bullet/Bullet.tscn"; + public const string prefab_weapon_bullet_Bullet1_tscn = "res://prefab/weapon/bullet/Bullet1.tscn"; + public const string prefab_weapon_bullet_Bullet2_tscn = "res://prefab/weapon/bullet/Bullet2.tscn"; public const string prefab_weapon_shell_ShellCase_tscn = "res://prefab/weapon/shell/ShellCase.tscn"; public const string resource_curve_Curve1_tres = "res://resource/curve/Curve1.tres"; public const string resource_effects_Circle_png = "res://resource/effects/Circle.png"; @@ -65,6 +66,7 @@ public const string resource_sprite_bullet_arrow_png = "res://resource/sprite/bullet/arrow.png"; public const string resource_sprite_bullet_bullet_png = "res://resource/sprite/bullet/bullet.png"; public const string resource_sprite_bullet_bullet2_png = "res://resource/sprite/bullet/bullet2.png"; + public const string resource_sprite_bullet_bullet3_png = "res://resource/sprite/bullet/bullet3.png"; public const string resource_sprite_effect_KnifeHit1_png = "res://resource/sprite/effect/KnifeHit1.png"; public const string resource_sprite_effect_Trajectory_png = "res://resource/sprite/effect/Trajectory.png"; public const string resource_sprite_effect_hit_hit0_png = "res://resource/sprite/effect/hit/hit0.png";