Browse Source

:wrench: Make space welcome messages different

DricomDragon 1 year ago
parent
commit
fc0283113b

+ 4 - 1
godot/component/ui/victory/victory_menu.gd

@@ -26,5 +26,8 @@ func _on_visibility_changed() -> void:
 	%TitleButton.grab_focus()
 
 
-func _on_bottom_limit_area_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index) -> void:
+func _on_space_reached(message: String = ""):
+	if message:
+		%Message.set_text(message)
+
 	show()

+ 3 - 2
godot/component/ui/victory/victory_menu.tscn

@@ -32,10 +32,11 @@ theme_override_font_sizes/font_size = 40
 text = "Victory!"
 horizontal_alignment = 1
 
-[node name="BlaBla" type="Label" parent="Panel/MarginContainer/TextContainer"]
+[node name="Message" type="Label" parent="Panel/MarginContainer/TextContainer"]
+unique_name_in_owner = true
 layout_mode = 2
 theme_override_font_sizes/font_size = 30
-text = "That's not a common way to go to space, but you are welcome !"
+text = "Welcome to space!"
 horizontal_alignment = 1
 autowrap_mode = 2
 

+ 10 - 0
godot/flow/signal_wire/space_limit.gd

@@ -0,0 +1,10 @@
+extends Node3D
+
+
+@export var message: String
+
+signal space_reached(message: String)
+
+
+func _on_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index) -> void:
+	space_reached.emit(message)

+ 9 - 3
godot/run/levels/infinite_level.tscn

@@ -1,4 +1,4 @@
-[gd_scene load_steps=26 format=3 uid="uid://7ivipmwaw24t"]
+[gd_scene load_steps=27 format=3 uid="uid://7ivipmwaw24t"]
 
 [ext_resource type="Texture2D" uid="uid://cgwafs6ukpm7y" path="res://component/entity/ground/ground051.jpg" id="1_3ytcp"]
 [ext_resource type="Script" path="res://run/levels/camera_tracker.gd" id="1_qdm47"]
@@ -18,6 +18,7 @@
 [ext_resource type="Texture2D" uid="uid://daewyr44tkkm0" path="res://effect/sky/sky_stk.jpg" id="15_5bqty"]
 [ext_resource type="PackedScene" uid="uid://c68bdcjpdm1y2" path="res://component/ui/pause/pause_menu.tscn" id="16_orqqe"]
 [ext_resource type="PackedScene" uid="uid://bmgwhm6ejsden" path="res://component/ui/victory/victory_menu.tscn" id="17_1u7wg"]
+[ext_resource type="Script" path="res://flow/signal_wire/space_limit.gd" id="19_3qyrt"]
 
 [sub_resource type="BoxShape3D" id="BoxShape3D_ctk0t"]
 size = Vector3(500, 10, 500)
@@ -416,6 +417,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -100, 0)
 collision_mask = 2
 input_ray_pickable = false
 monitorable = false
+script = ExtResource("19_3qyrt")
+message = "That's not a common way to go to space, but you are welcome !"
 
 [node name="BottomLimitShape" type="CollisionShape3D" parent="Limits/BottomLimitArea"]
 shape = SubResource("WorldBoundaryShape3D_cdiox")
@@ -425,6 +428,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 499.501, 0)
 collision_mask = 2
 input_ray_pickable = false
 monitorable = false
+script = ExtResource("19_3qyrt")
 
 [node name="BottomLimitShape" type="CollisionShape3D" parent="Limits/TopLimitArea"]
 transform = Transform3D(-1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0)
@@ -438,5 +442,7 @@ shape = SubResource("WorldBoundaryShape3D_cdiox")
 [connection signal="main_action" from="MainWalker/Control" to="MainWalker" method="_on_main_action"]
 [connection signal="start_game" from="UI/TitleScreen" to="MainWalker/Control" method="_on_title_screen_start_game"]
 [connection signal="visibility_changed" from="UI/VictoryMenu" to="MainWalker/Control" method="_on_victory_menu_visibility_changed"]
-[connection signal="body_shape_entered" from="Limits/BottomLimitArea" to="UI/VictoryMenu" method="_on_bottom_limit_area_body_shape_entered"]
-[connection signal="body_shape_entered" from="Limits/TopLimitArea" to="UI/VictoryMenu" method="_on_bottom_limit_area_body_shape_entered"]
+[connection signal="body_shape_entered" from="Limits/BottomLimitArea" to="Limits/BottomLimitArea" method="_on_body_shape_entered"]
+[connection signal="space_reached" from="Limits/BottomLimitArea" to="UI/VictoryMenu" method="_on_space_reached"]
+[connection signal="body_shape_entered" from="Limits/TopLimitArea" to="Limits/TopLimitArea" method="_on_body_shape_entered"]
+[connection signal="space_reached" from="Limits/TopLimitArea" to="UI/VictoryMenu" method="_on_space_reached"]