Files
MovementTests/godot_state_charts_examples/stepping/stepping.tscn
Minimata af1f6da98d
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 31s
Create tag and build when new code gets to main / Test (push) Has been cancelled
Create tag and build when new code gets to main / Export (push) Has been cancelled
updating project files
2026-01-28 09:50:10 +01:00

107 lines
4.8 KiB
Plaintext

[gd_scene format=3 uid="uid://iewxecs0uwss"]
[ext_resource type="Script" uid="uid://dctc1yeiwh0wx" path="res://godot_state_charts_examples/stepping/stepping.gd" id="1_8d8ax"]
[ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="1_u4aev"]
[ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="2_7ehwm"]
[ext_resource type="Script" uid="uid://c1vp0ojjvaby1" path="res://addons/godot_state_charts/parallel_state.gd" id="4_ohpt6"]
[ext_resource type="Script" uid="uid://jk2jm1g6q853" path="res://addons/godot_state_charts/compound_state.gd" id="5_xbwwa"]
[ext_resource type="Script" uid="uid://cytafq8i1y8qm" path="res://addons/godot_state_charts/atomic_state.gd" id="6_n6kwq"]
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="7_78ppn"]
[node name="SteppingExample" type="Node2D" unique_id=768576582]
script = ExtResource("1_8d8ax")
[node name="StateChartDebugger" parent="." unique_id=1716622941 instance=ExtResource("1_u4aev")]
offset_left = 353.0
offset_top = 5.0
offset_right = 635.0
offset_bottom = 326.0
initial_node_to_watch = NodePath("../StateChart")
[node name="NextRoundButton" type="Button" parent="." unique_id=387423607]
offset_left = 500.0
offset_top = 421.0
offset_right = 611.0
offset_bottom = 454.0
text = "Next Round"
[node name="AddCoalToDrillButton" type="Button" parent="." unique_id=756509678]
unique_name_in_owner = true
offset_left = 371.0
offset_top = 422.0
offset_right = 482.0
offset_bottom = 455.0
text = "Add Coal"
[node name="StateChart" type="Node" parent="." unique_id=1880010090]
unique_name_in_owner = true
script = ExtResource("2_7ehwm")
track_in_editor = true
[node name="Root" type="Node" parent="StateChart" unique_id=1862724482]
script = ExtResource("4_ohpt6")
[node name="Drill" type="Node" parent="StateChart/Root" unique_id=428332976]
script = ExtResource("5_xbwwa")
initial_state = NodePath("Drill Has No Coal")
[node name="Drill Has Coal" type="Node" parent="StateChart/Root/Drill" unique_id=1319519654]
editor_description = "When in this state, the drill has coal and will produce two more coal per round."
script = ExtResource("6_n6kwq")
[node name="On Coal Depleted" type="Node" parent="StateChart/Root/Drill/Drill Has Coal" unique_id=1451112502]
script = ExtResource("7_78ppn")
to = NodePath("../../Drill Has No Coal")
event = &"coal_depleted"
delay_in_seconds = "0.0"
[node name="Drill Has No Coal" type="Node" parent="StateChart/Root/Drill" unique_id=1616848461]
editor_description = "When in this state, the drill will do nothing."
script = ExtResource("6_n6kwq")
[node name="On Coal Available" type="Node" parent="StateChart/Root/Drill/Drill Has No Coal" unique_id=604312784]
script = ExtResource("7_78ppn")
to = NodePath("../../Drill Has Coal")
event = &"coal_available"
delay_in_seconds = "0.0"
[node name="GridContainer" type="GridContainer" parent="." unique_id=1245828139]
offset_left = 366.0
offset_top = 333.0
offset_right = 518.0
offset_bottom = 389.0
columns = 2
[node name="Label" type="Label" parent="GridContainer" unique_id=469540420]
layout_mode = 2
text = "Coal mined: "
[node name="CoalAvailableLabel" type="Label" parent="GridContainer" unique_id=118859305]
unique_name_in_owner = true
layout_mode = 2
text = "0"
[node name="Label2" type="Label" parent="GridContainer" unique_id=750042110]
layout_mode = 2
text = "Coal in drill:"
[node name="CoalInDrillLabel" type="Label" parent="GridContainer" unique_id=1230109760]
unique_name_in_owner = true
layout_mode = 2
text = "0"
[node name="Info" type="Label" parent="." unique_id=24109398]
offset_left = 13.0
offset_top = 22.0
offset_right = 322.0
offset_bottom = 254.0
text = "This is a super-simple example on how to use the \"step\" function to use a state chart in a turn-based game.
This simulates a coal-driven mining drill which consumes one coal per round and produces two coal per round when running. You can press the \"Add Coal\" button to add coal into the mining drill. Press \"Next Round\" to simulate the next round. This will call the \"step\" method and then execute code depending on which state the mining drill is currently in (e.g. either mine 2 coal or do nothing if the drill is off because it has no more coal)."
autowrap_mode = 2
[connection signal="pressed" from="NextRoundButton" to="." method="_on_next_round_button_pressed"]
[connection signal="pressed" from="AddCoalToDrillButton" to="." method="_on_add_coal_to_drill_button_pressed"]
[connection signal="state_stepped" from="StateChart/Root/Drill/Drill Has Coal" to="." method="_on_drill_has_coal_state_stepped"]
[connection signal="state_stepped" from="StateChart/Root/Drill/Drill Has No Coal" to="." method="_on_drill_has_no_coal_state_stepped"]