add gamestate, doc and fix

This commit is contained in:
2026-04-16 11:01:04 +02:00
parent dc0bf0ba37
commit e02bd1819f
29 changed files with 466 additions and 71 deletions

View File

@@ -52,3 +52,41 @@ environment = SubResource("Environment_lmjyn")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=269230449]
transform = Transform3D(1, 0, 0, 0, 0.17952333, 0.98375374, 0, -0.98375374, 0.17952333, 0, 18.920979, 0)
[node name="Control" type="Control" parent="." unique_id=1072240389]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="Control" unique_id=1647272132]
layout_mode = 0
offset_left = 50.0
offset_top = 50.0
offset_right = 400.0
offset_bottom = 827.0
[node name="Label" type="Label" parent="Control/PanelContainer" unique_id=272421245]
custom_minimum_size = Vector2(1, 1)
layout_mode = 2
size_flags_vertical = 1
text = "System Logic:
- The NPC is based on CharacterBody3D and is managed via a Finite State Machine (FSM).
- Movement and navigation are calculated during the _physics_process.
AI States:
- IdleState: The agent remains stationary for the duration defined by the wait_time variable.
- PatrolState: The agent calculates a valid random point and moves toward it.
Core Components:
- NavigationAgent3D: Manages pathfinding and detects when the agent reaches its destination.
- PatrolRadiusShape: Defines the radius of the area where the agent can move randomly.
- StateMachine: Coordinates transitions between states, such as the automatic switch from Idle to Patrol.
Parameters:
- Speed: Movement speed of the agent.
- Wait Time: Delay in seconds within the IdleState node.
- Area Radius: Size of the SphereShape3D inside the PatrolRadiusShape node."
autowrap_mode = 2