diff --git a/DungeonShooting_Art/effect/Smoke.png b/DungeonShooting_Art/effect/Smoke.png new file mode 100644 index 0000000..f358c57 --- /dev/null +++ b/DungeonShooting_Art/effect/Smoke.png Binary files differ diff --git a/DungeonShooting_Godot/prefab/effect/BulletSmoke.tscn b/DungeonShooting_Godot/prefab/effect/BulletSmoke.tscn new file mode 100644 index 0000000..31d008e --- /dev/null +++ b/DungeonShooting_Godot/prefab/effect/BulletSmoke.tscn @@ -0,0 +1,90 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://resource/effects/Smoke.png" type="Texture" id=1] + +[sub_resource type="CanvasItemMaterial" id=1] +particles_animation = true +particles_anim_h_frames = 3 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="Curve" id=3] +_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.108939, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ] + +[sub_resource type="CurveTexture" id=4] +curve = SubResource( 3 ) + +[sub_resource type="ParticlesMaterial" id=2] +flag_disable_z = true +spread = 25.0 +gravity = Vector3( 0, 0, 0 ) +initial_velocity = 90.0 +initial_velocity_random = 0.9 +angular_velocity = 360.0 +angular_velocity_random = 1.0 +orbit_velocity = 0.0 +orbit_velocity_random = 0.0 +angle = 360.0 +angle_random = 1.0 +scale_curve = SubResource( 4 ) +color = Color( 0.392157, 0.392157, 0.392157, 0.392157 ) +anim_offset = 1.0 +anim_offset_random = 1.0 + +[sub_resource type="Animation" id=5] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath(".:emitting") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ false ] +} + +[sub_resource type="Animation" id=6] +resource_name = "Smoke" +tracks/0/type = "value" +tracks/0/path = NodePath(".:emitting") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/1/type = "method" +tracks/1/path = NodePath(".") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 1 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "queue_free" +} ] +} + +[node name="BulletSmoke" type="Particles2D"] +material = SubResource( 1 ) +emitting = false +lifetime = 0.4 +one_shot = true +explosiveness = 0.9 +process_material = SubResource( 2 ) +texture = ExtResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "Smoke" +anims/RESET = SubResource( 5 ) +anims/Smoke = SubResource( 6 ) diff --git a/DungeonShooting_Godot/resource/effects/Smoke.png b/DungeonShooting_Godot/resource/effects/Smoke.png new file mode 100644 index 0000000..f358c57 --- /dev/null +++ b/DungeonShooting_Godot/resource/effects/Smoke.png Binary files differ diff --git a/DungeonShooting_Godot/resource/effects/Smoke.png.import b/DungeonShooting_Godot/resource/effects/Smoke.png.import new file mode 100644 index 0000000..fae5930 --- /dev/null +++ b/DungeonShooting_Godot/resource/effects/Smoke.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Smoke.png-7f6cb73c1414481cc8ba911eefd55a69.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/effects/Smoke.png" +dest_files=[ "res://.import/Smoke.png-7f6cb73c1414481cc8ba911eefd55a69.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/DungeonShooting_Godot/src/game/item/weapon/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/item/weapon/bullet/Bullet.cs index 956f1c5..074ffbe 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/bullet/Bullet.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/bullet/Bullet.cs @@ -67,7 +67,7 @@ // hit.RotationDegrees = Utils.RandRangeInt(0, 360); // hit.GlobalPosition = GlobalPosition; // GameApplication.Instance.Room.GetRoot(true).AddChild(hit); - + DoDestroy(); } } @@ -82,9 +82,16 @@ private void DoDestroy() { - SpecialEffectManager.Play(ResourcePath.resource_effects_Hit_tres, "default", GlobalPosition, - Mathf.Deg2Rad(Utils.RandRangeInt(0, 360)), Vector2.One, new Vector2(1, 11), 0); + // SpecialEffectManager.Play(ResourcePath.resource_effects_Hit_tres, "default", GlobalPosition, + // Mathf.Deg2Rad(Utils.RandRangeInt(0, 360)), Vector2.One, new Vector2(1, 11), 0); + //创建粒子特效 + var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_BulletSmoke_tscn); + var smoke = packedScene.Instance(); + smoke.Position = Position; + smoke.Rotation = Rotation - Mathf.Pi; + GameApplication.Instance.Room.GetRoot(true).AddChild(smoke); + Destroy(); } } \ 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 2bd3d81..e5f55c4 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -11,6 +11,7 @@ public const string editor_prefabs_CodePanel_tscn = "res://editor/prefabs/CodePanel.tscn"; public const string editor_prefabs_Editor_tscn = "res://editor/prefabs/Editor.tscn"; public const string prefab_FanCollisionShape_tscn = "res://prefab/FanCollisionShape.tscn"; + public const string prefab_effect_BulletSmoke_tscn = "res://prefab/effect/BulletSmoke.tscn"; public const string prefab_effect_FirePart_tscn = "res://prefab/effect/FirePart.tscn"; public const string prefab_role_CPlusPlus_tscn = "res://prefab/role/CPlusPlus.tscn"; public const string prefab_role_Enemy_tscn = "res://prefab/role/Enemy.tscn"; @@ -28,6 +29,7 @@ public const string resource_effects_debug_arrows_png = "res://resource/effects/debug_arrows.png"; public const string resource_effects_Hit_tres = "res://resource/effects/Hit.tres"; public const string resource_effects_KnifeHit1_tres = "res://resource/effects/KnifeHit1.tres"; + public const string resource_effects_Smoke_png = "res://resource/effects/Smoke.png"; public const string resource_font_cn_font_12_tres = "res://resource/font/cn_font_12.tres"; public const string resource_font_cn_font_18_tres = "res://resource/font/cn_font_18.tres"; public const string resource_font_cn_font_36_tres = "res://resource/font/cn_font_36.tres";