diff --git a/scenes/burner.tscn b/scenes/burner.tscn index 1c7ee4c..ebe473c 100644 --- a/scenes/burner.tscn +++ b/scenes/burner.tscn @@ -5,6 +5,49 @@ [ext_resource type="Script" uid="uid://d3v8045s7423j" path="res://src/button_gens/burner_button.gd" id="3_tuoyb"] [ext_resource type="Script" uid="uid://iv0p3iafoogu" path="res://src/burn_area.gd" id="4_s4s5n"] +[sub_resource type="Gradient" id="Gradient_q8h83"] +colors = PackedColorArray(1, 0, 0, 1, 1, 1, 1, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_s4s5n"] +gradient = SubResource("Gradient_q8h83") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_s4s5n"] +direction = Vector3(0, 1, 0) +spread = 15.0 +initial_velocity_min = 1.0 +initial_velocity_max = 3.0 +gravity = Vector3(0, 0, 0) +color_ramp = SubResource("GradientTexture1D_s4s5n") +turbulence_enabled = true +turbulence_noise_strength = 0.05 +turbulence_influence_min = 0.010000001 +turbulence_influence_max = 0.05 + +[sub_resource type="Gradient" id="Gradient_s4s5n"] +interpolation_mode = 2 +offsets = PackedFloat32Array(0.48969072, 1) +colors = PackedColorArray(1, 0.4025873, 0.3083908, 1, 1, 1, 0, 0) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_1xpes"] +gradient = SubResource("Gradient_s4s5n") +fill = 1 +fill_from = Vector2(0.5, 0.5) +fill_to = Vector2(0.8, 0.2) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_q8h83"] +transparency = 1 +shading_mode = 0 +vertex_color_use_as_albedo = true +albedo_texture = SubResource("GradientTexture2D_1xpes") +billboard_mode = 3 +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="QuadMesh" id="QuadMesh_s4s5n"] +material = SubResource("StandardMaterial3D_q8h83") +size = Vector2(0.05, 0.05) + [sub_resource type="CylinderShape3D" id="CylinderShape3D_83yjx"] height = 0.42895508 radius = 0.2241211 @@ -17,6 +60,13 @@ radius = 0.103515625 script = ExtResource("1_v8cqm") button_generator = NodePath("ButtonGen") +[node name="GPUParticles3D" type="GPUParticles3D" parent="." unique_id=2009304658] +transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0.383016, 0) +emitting = false +amount = 30 +process_material = SubResource("ParticleProcessMaterial_s4s5n") +draw_pass_1 = SubResource("QuadMesh_s4s5n") + [node name="SPIRTOVKA" parent="." unique_id=410340270 instance=ExtResource("2_83yjx")] transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0) @@ -24,8 +74,10 @@ transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2145507, 0) shape = SubResource("CylinderShape3D_83yjx") -[node name="ButtonGen" type="Node" parent="." unique_id=739595415] +[node name="ButtonGen" type="Node" parent="." unique_id=739595415 node_paths=PackedStringArray("cap", "particles")] script = ExtResource("3_tuoyb") +cap = NodePath("../SPIRTOVKA/Cap") +particles = NodePath("../GPUParticles3D") [node name="BurnArea" type="Area3D" parent="." unique_id=1510885909] collision_mask = 5 @@ -38,3 +90,5 @@ shape = SubResource("CylinderShape3D_tuoyb") [connection signal="area_entered" from="BurnArea" to="BurnArea" method="_on_area_entered"] [connection signal="area_exited" from="BurnArea" to="BurnArea" method="_on_area_exited"] + +[editable path="SPIRTOVKA"] diff --git a/src/button_gens/burner_button.gd b/src/button_gens/burner_button.gd index 4e1e533..9fc84cd 100644 --- a/src/button_gens/burner_button.gd +++ b/src/button_gens/burner_button.gd @@ -1,13 +1,19 @@ extends ButtonGenerator +@export var cap : MeshInstance3D +@export var particles: GPUParticles3D +@onready var burn_area:= $"../BurnArea" + func get_buttons() -> Control: var burn_button: Button = Button.new() - burn_button.text = "Потушить спиртовку" if $"../BurnArea".enabled else "Зажечь спиртовку" + burn_button.text = "Потушить спиртовку" if burn_area.enabled else "Зажечь спиртовку" burn_button.pressed.connect(toggle_burner) return burn_button func toggle_burner() -> void: - $"../BurnArea".enabled = not $"../BurnArea".enabled + burn_area.enabled = not burn_area.enabled GuiSignalBus.add_buttons.emit(get_buttons()) + cap.visible = not burn_area.enabled + particles.emitting = burn_area.enabled