diff --git a/addons/kenney_particle_pack/circle_05.png.import b/addons/kenney_particle_pack/circle_05.png.import index aa32d3b..d10994d 100644 --- a/addons/kenney_particle_pack/circle_05.png.import +++ b/addons/kenney_particle_pack/circle_05.png.import @@ -3,25 +3,26 @@ importer="texture" type="CompressedTexture2D" uid="uid://b8yqiftn6q2ij" -path="res://.godot/imported/circle_05.png-2d6c777c446ba2a583b61d30e52bc466.ctex" +path.s3tc="res://.godot/imported/circle_05.png-2d6c777c446ba2a583b61d30e52bc466.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://addons/kenney_particle_pack/circle_05.png" -dest_files=["res://.godot/imported/circle_05.png-2d6c777c446ba2a583b61d30e52bc466.ctex"] +dest_files=["res://.godot/imported/circle_05.png-2d6c777c446ba2a583b61d30e52bc466.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 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/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -31,4 +32,4 @@ 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 +detect_3d/compress_to=0 diff --git a/addons/kenney_particle_pack/muzzle_01.png.import b/addons/kenney_particle_pack/muzzle_01.png.import index d8d4044..94af468 100644 --- a/addons/kenney_particle_pack/muzzle_01.png.import +++ b/addons/kenney_particle_pack/muzzle_01.png.import @@ -3,25 +3,26 @@ importer="texture" type="CompressedTexture2D" uid="uid://cpqufbjs2rf5t" -path="res://.godot/imported/muzzle_01.png-6b5b53ab7ff581d37d9574d2b01cae58.ctex" +path.s3tc="res://.godot/imported/muzzle_01.png-6b5b53ab7ff581d37d9574d2b01cae58.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://addons/kenney_particle_pack/muzzle_01.png" -dest_files=["res://.godot/imported/muzzle_01.png-6b5b53ab7ff581d37d9574d2b01cae58.ctex"] +dest_files=["res://.godot/imported/muzzle_01.png-6b5b53ab7ff581d37d9574d2b01cae58.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 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/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -31,4 +32,4 @@ 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 +detect_3d/compress_to=0 diff --git a/particle-effects.tscn b/particle-effects.tscn index ad22f6b..30f428c 100644 --- a/particle-effects.tscn +++ b/particle-effects.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://chomobsn1vdo4"] +[gd_scene load_steps=12 format=3 uid="uid://chomobsn1vdo4"] [ext_resource type="Environment" uid="uid://dxrk0u62aekxt" path="res://environments/black-environment.tres" id="1_k1rat"] [ext_resource type="PackedScene" uid="uid://cxj4cf67il71y" path="res://particles/smoke.tscn" id="1_vs4eb"] @@ -8,6 +8,7 @@ [ext_resource type="PackedScene" uid="uid://b2dthk7xytysh" path="res://particles/shield.tscn" id="5_iqqai"] [ext_resource type="PackedScene" uid="uid://ck5vuhi3tffgl" path="res://particles/sparks.tscn" id="6_n8y86"] [ext_resource type="PackedScene" uid="uid://1nbihtdf4hnv" path="res://particles/rain.tscn" id="8_pqidy"] +[ext_resource type="PackedScene" uid="uid://jyk4uwcupa50" path="res://particles/impact.tscn" id="9_x76w5"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_njwlo"] shading_mode = 0 @@ -53,8 +54,21 @@ visible = false visible = false [node name="Shield" parent="." instance=ExtResource("5_iqqai")] +visible = false [node name="Sparks" parent="." instance=ExtResource("6_n8y86")] visible = false [node name="Rain" parent="." instance=ExtResource("8_pqidy")] +visible = false + +[node name="Impact" parent="." instance=ExtResource("9_x76w5")] + +[node name="Shockwave" type="Node3D" parent="."] +visible = false + +[node name="Electricity" type="Node3D" parent="."] +visible = false + +[node name="Implosion" type="Node3D" parent="."] +visible = false diff --git a/particles/impact.tscn b/particles/impact.tscn new file mode 100644 index 0000000..a77fada --- /dev/null +++ b/particles/impact.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=13 format=3 uid="uid://jyk4uwcupa50"] + +[ext_resource type="Texture2D" uid="uid://cpqufbjs2rf5t" path="res://addons/kenney_particle_pack/muzzle_01.png" id="1_nj335"] +[ext_resource type="Texture2D" uid="uid://b8yqiftn6q2ij" path="res://addons/kenney_particle_pack/circle_05.png" id="2_6unvo"] + +[sub_resource type="Curve" id="Curve_lqnej"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.370492, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="CurveTexture" id="CurveTexture_rymgb"] +curve = SubResource("Curve_lqnej") + +[sub_resource type="Curve" id="Curve_mr68g"] +_data = [Vector2(0, 0.521682), 0.0, 0.0, 0, 0, Vector2(0.144262, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_7xpum"] +curve = SubResource("Curve_mr68g") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_s3tbj"] +gravity = Vector3(0, 0, 0) +scale_curve = SubResource("CurveTexture_7xpum") +alpha_curve = SubResource("CurveTexture_rymgb") +sub_emitter_mode = 2 +sub_emitter_amount_at_end = 1 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ky36s"] +transparency = 1 +blend_mode = 1 +vertex_color_use_as_albedo = true +albedo_color = Color(1, 1, 1, 0.0392157) +albedo_texture = ExtResource("1_nj335") +rim_enabled = true +billboard_mode = 3 +billboard_keep_scale = true +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="QuadMesh" id="QuadMesh_ot0ot"] +material = SubResource("StandardMaterial3D_ky36s") +center_offset = Vector3(0, 0.4, 0) + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_iv2ux"] +direction = Vector3(0, 2, 0) +initial_velocity_min = 3.0 +initial_velocity_max = 3.0 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6ojok"] +transparency = 1 +vertex_color_use_as_albedo = true +albedo_texture = ExtResource("2_6unvo") +billboard_mode = 3 +billboard_keep_scale = true +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="QuadMesh" id="QuadMesh_pmnps"] +material = SubResource("StandardMaterial3D_6ojok") +size = Vector2(0.1, 0.1) + +[node name="Impact" type="Node3D"] + +[node name="GPUParticles3D" type="GPUParticles3D" parent="."] +amount = 10 +sub_emitter = NodePath("../GPUParticles3D2") +explosiveness = 1.0 +fixed_fps = 60 +process_material = SubResource("ParticleProcessMaterial_s3tbj") +draw_pass_1 = SubResource("QuadMesh_ot0ot") + +[node name="GPUParticles3D2" type="GPUParticles3D" parent="."] +process_material = SubResource("ParticleProcessMaterial_iv2ux") +draw_pass_1 = SubResource("QuadMesh_pmnps") diff --git a/particles/shield.tscn b/particles/shield.tscn index dd63376..6eefe43 100644 --- a/particles/shield.tscn +++ b/particles/shield.tscn @@ -64,8 +64,9 @@ material = SubResource("StandardMaterial3D_lmrnj") size = Vector2(1.5, 1.5) [sub_resource type="Curve" id="Curve_8kor2"] +min_value = -360.0 max_value = 360.0 -_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 360), 0.0, 0.0, 0, 0] +_data = [Vector2(0, -360), 0.0, 0.0, 0, 0, Vector2(1, 360), 0.0, 0.0, 0, 0] point_count = 2 [sub_resource type="CurveTexture" id="CurveTexture_7lrlq"] @@ -83,17 +84,16 @@ curve = SubResource("Curve_jwnch") [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_eugrd"] particle_flag_align_y = true particle_flag_rotate_y = true -angle_max = 1.0 angle_curve = SubResource("CurveTexture_7lrlq") direction = Vector3(0, 0, 0) angular_velocity_min = 0.1 angular_velocity_max = 0.1 angular_velocity_curve = SubResource("CurveTexture_1uygt") gravity = Vector3(0, 0, 0) -color = Color(0, 0.647059, 1, 0.501961) +color = Color(0.796078, 0.760784, 1, 0.501961) [sub_resource type="Gradient" id="Gradient_q8hwq"] -offsets = PackedFloat32Array(0.58363, 0.6121, 0.651246) +offsets = PackedFloat32Array(0.587189, 0.6121, 0.629893) colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0) [sub_resource type="GradientTexture2D" id="GradientTexture2D_irpch"] @@ -106,6 +106,7 @@ fill_from = Vector2(0.5, 0.5) [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6lgl3"] transparency = 1 blend_mode = 1 +vertex_color_use_as_albedo = true albedo_texture = SubResource("GradientTexture2D_irpch") billboard_keep_scale = true @@ -115,7 +116,6 @@ size = Vector2(1.2, 1.2) orientation = 0 [node name="Shield" type="Node3D"] -visible = false [node name="Sphere" type="GPUParticles3D" parent="."] amount = 1 diff --git a/scripts/MultiParticles.cs b/scripts/MultiParticles.cs index a671d0d..81e4e39 100644 --- a/scripts/MultiParticles.cs +++ b/scripts/MultiParticles.cs @@ -1,68 +1,65 @@ using System; using Godot; -namespace GodotVisualEffectsToolkit +/** + * MultiParticles : Node3D + * + * This class turns possible to control multiple particles in sync. + * Inspired by https://www.reddit.com/r/godot/comments/181ui9c/comment/kaewcca/?context=3 + */ +public partial class MultiParticles : Node3D { - /** - * MultiParticles : Node3D - * - * This class turns possible to control multiple particles in sync. - * Inspired by https://www.reddit.com/r/godot/comments/181ui9c/comment/kaewcca/?context=3 - */ - public partial class MultiParticles : Node3D + [Export] + public bool Emitting = true; + + [Export] + public bool OneShot = false; + + [Export] + public Godot.Collections.Array Particles; + + double Lifetime = 0.0f; + + public override void _Ready() { - [Export] - public bool Emitting = true; - - [Export] - public bool OneShot = false; - - [Export] - public Godot.Collections.Array Particles; - - double Lifetime = 0.0f; - - public override void _Ready() + if (Emitting) { - if (Emitting) - { - StartEmitters(); - } + StartEmitters(); } + } - void GetLifetime() + void GetLifetime() + { + foreach (var particle in Particles) { - foreach (var particle in Particles) + if (particle.Lifetime > Lifetime) { - if (particle.Lifetime > Lifetime) - { - Lifetime = particle.Lifetime; - } - } - } - - public async void StartEmitters() - { - GetLifetime(); - - foreach (var particle in Particles) - particle.Emitting = true; - - await ToSignal(GetTree().CreateTimer(Lifetime), SceneTreeTimer.SignalName.Timeout); - DisposeOfEmitters(); - - if (!OneShot) - { - StartEmitters(); - } - } - - void DisposeOfEmitters() - { - foreach (var particle in Particles) - { - particle.Emitting = false; + Lifetime = particle.Lifetime; } } } + + public async void StartEmitters() + { + GetLifetime(); + + foreach (var particle in Particles) + particle.Emitting = true; + + await ToSignal(GetTree().CreateTimer(Lifetime), SceneTreeTimer.SignalName.Timeout); + DisposeOfEmitters(); + + if (!OneShot) + { + StartEmitters(); + } + } + + void DisposeOfEmitters() + { + foreach (var particle in Particles) + { + particle.Emitting = false; + } + } }