diff --git a/DungeonShooting_Art/effect/Circle.png b/DungeonShooting_Art/effect/Circle.png new file mode 100644 index 0000000..b441812 --- /dev/null +++ b/DungeonShooting_Art/effect/Circle.png Binary files differ diff --git a/DungeonShooting_Godot/prefab/effect/Blood.tscn b/DungeonShooting_Godot/prefab/effect/Blood.tscn new file mode 100644 index 0000000..1c7a044 --- /dev/null +++ b/DungeonShooting_Godot/prefab/effect/Blood.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://resource/effects/Circle.png" type="Texture" id=1] +[ext_resource path="res://src/game/effects/Blood.cs" type="Script" id=2] + +[sub_resource type="ParticlesMaterial" id=1] +flag_disable_z = true +gravity = Vector3( 0, 0, 0 ) +initial_velocity = 70.0 +initial_velocity_random = 1.0 +orbit_velocity = 0.0 +orbit_velocity_random = 0.0 +scale = 0.1 +scale_random = 0.3 +color = Color( 0.792157, 0, 0, 1 ) + +[node name="Blood" type="Particles2D"] +emitting = false +lifetime = 0.5 +one_shot = true +explosiveness = 0.9 +process_material = SubResource( 1 ) +texture = ExtResource( 1 ) +script = ExtResource( 2 ) diff --git a/DungeonShooting_Godot/resource/effects/Circle.png b/DungeonShooting_Godot/resource/effects/Circle.png new file mode 100644 index 0000000..b441812 --- /dev/null +++ b/DungeonShooting_Godot/resource/effects/Circle.png Binary files differ diff --git a/DungeonShooting_Godot/resource/effects/Circle.png.import b/DungeonShooting_Godot/resource/effects/Circle.png.import new file mode 100644 index 0000000..4b5e09c --- /dev/null +++ b/DungeonShooting_Godot/resource/effects/Circle.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Circle.png-768473019d8d1278c7455b04b18ad833.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/effects/Circle.png" +dest_files=[ "res://.import/Circle.png-768473019d8d1278c7455b04b18ad833.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/effects/Blood.cs b/DungeonShooting_Godot/src/game/effects/Blood.cs new file mode 100644 index 0000000..d62fd08 --- /dev/null +++ b/DungeonShooting_Godot/src/game/effects/Blood.cs @@ -0,0 +1,24 @@ +using Godot; + +public class Blood : Particles2D +{ + public override void _Ready() + { + Emitting = true; + Life(); + } + + private async void Life() + { + var timer = GetTree().CreateTimer(0.4f); + await ToSignal(timer, "timeout"); + Emitting = false; + GD.Print("冻结"); + SetProcess(false); + SetPhysicsProcess(false); + SetProcessInput(false); + SetProcessInternal(false); + SetProcessUnhandledInput(false); + SetProcessUnhandledKeyInput(false); + } +} \ 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 bdf4124..48840a6 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_Blood_tscn = "res://prefab/effect/Blood.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_effect_ShotFire_tscn = "res://prefab/effect/ShotFire.tscn"; @@ -27,6 +28,7 @@ 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_shell_ShellCase_tscn = "res://prefab/weapon/shell/ShellCase.tscn"; + public const string resource_effects_Circle_png = "res://resource/effects/Circle.png"; public const string resource_effects_Collision_png = "res://resource/effects/Collision.png"; 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"; diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs index d46d517..43c9fde 100644 --- a/DungeonShooting_Godot/src/game/role/Role.cs +++ b/DungeonShooting_Godot/src/game/role/Role.cs @@ -488,6 +488,10 @@ else { Hp -= damage; + // var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_Blood_tscn); + // var particles2D = packedScene.Instance(); + // particles2D.GlobalPosition = GlobalPosition; + // GameApplication.Instance.Room.GetRoot().AddChild(particles2D); } PlayHitAnimation();