add gamestate, doc and fix
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var collection_compendium: Control = $Control/CollectionCompendium
|
||||
@onready var gallery: Control = $%Gallery
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
collection_compendium.visible = !collection_compendium.visible
|
||||
|
||||
func _on_button_gallery_pressed() -> void:
|
||||
gallery.visible = !gallery.visible
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
[ext_resource type="PackedScene" uid="uid://bmkxt6btcx8qr" path="res://core/photo_mode/collectible.tscn" id="2_48mla"]
|
||||
[ext_resource type="Script" uid="uid://bj34o0org55ei" path="res://core/photo_mode/collectible_resource.gd" id="3_hh1ka"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3grftlmap4q5" path="res://docs/museums/daynight/scenes/grain_test/leaf_test.png" id="4_fan5s"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvw086glfpcba" path="res://core/photo_mode/collection_compendium.tscn" id="5_ws0fy"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvw086glfpcba" path="res://core/photo_mode/collectible_gallery.tscn" id="5_ws0fy"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6r787sik5yil" path="res://core/photo_mode/photo_gallery.tscn" id="7_fh4km"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_48mla"]
|
||||
|
||||
@@ -67,14 +68,70 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Button" type="Button" parent="Control" unique_id=539195532]
|
||||
[node name="ButtonGallery" type="Button" parent="Control" unique_id=539195532]
|
||||
layout_mode = 0
|
||||
offset_right = 8.0
|
||||
offset_bottom = 8.0
|
||||
text = "Compendium"
|
||||
offset_left = 50.0
|
||||
offset_top = 50.0
|
||||
offset_right = 163.0
|
||||
offset_bottom = 81.0
|
||||
text = "Menu"
|
||||
|
||||
[node name="CollectionCompendium" parent="Control" unique_id=354419843 instance=ExtResource("5_ws0fy")]
|
||||
[node name="Gallery" type="HSplitContainer" parent="Control" unique_id=1388833682]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 420.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[connection signal="pressed" from="Control/Button" to="." method="_on_button_pressed"]
|
||||
[node name="CollectibleGallery" parent="Control/Gallery" unique_id=354419843 instance=ExtResource("5_ws0fy")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="PhotoGallery" parent="Control/Gallery" unique_id=263414560 instance=ExtResource("7_fh4km")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Control" unique_id=2015953740]
|
||||
layout_mode = 0
|
||||
offset_left = 50.0
|
||||
offset_top = 150.0
|
||||
offset_right = 400.0
|
||||
offset_bottom = 927.0
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Control/PanelContainer" unique_id=1474258594]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/PanelContainer/ScrollContainer" unique_id=1982569320]
|
||||
custom_minimum_size = Vector2(1, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "System Logic:
|
||||
- The system allows players to toggle a free camera mode to photograph and collect museum items.
|
||||
- Game Pause: Activating the mode pauses the SceneTree, freezing the world while allowing the camera to remain functional.
|
||||
- It uses a raycasting check to verify if a collectible is visible and unobstructed before unlocking it.
|
||||
- The CollectionManager acts as a global singleton to track unlocked IDs and manage the library data.
|
||||
- Save Collectibles and Photo
|
||||
|
||||
Photo Mode Actions:
|
||||
- Toggle Mode(P): Switches between normal gameplay and the photo camera, capturing or releasing the mouse, and toggles the global pause state.
|
||||
- Orbit & Pan(Mouse): The camera rotates around a target and can be panned horizontally or vertically.
|
||||
- Capture(F): Performs a frustum check and a raycast to identify the target in view.
|
||||
|
||||
Core Components:
|
||||
- PhotoModeController: Manages camera inputs, movement logic, and the photo-taking process.
|
||||
- Collectible: An Area3D node placed on objects to make them identifiable by the camera.
|
||||
- CollectionManager: Handles the logic for unlocking items and provides data to the UI.
|
||||
- CollectionCompendium: A UI grid that displays all items and visually highlights unlocked ones.
|
||||
|
||||
Parameters:
|
||||
- Pan & Rotation Speed: Defines how fast the camera moves and rotates.
|
||||
- Movement Bounds: An AABB that restricts the camera's panning area.
|
||||
- Collectible Data: Resource files containing the ID, title, and image for each item.
|
||||
- Library: A central list of all CollectibleResources registered in the game."
|
||||
autowrap_mode = 2
|
||||
|
||||
[connection signal="pressed" from="Control/ButtonGallery" to="." method="_on_button_gallery_pressed"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var radio: Radio = $Radio
|
||||
|
||||
@onready var radio: Radio = $%Radio
|
||||
@onready var button_pause_resume: Button = $%Button_Pause_Resume
|
||||
|
||||
func _on_button_play_pressed() -> void:
|
||||
if !radio.playing:
|
||||
@@ -10,10 +10,12 @@ func _on_button_play_pressed() -> void:
|
||||
|
||||
func _on_button_pause_pressed() -> void:
|
||||
radio.toggle_pause()
|
||||
if !button_pause_resume:
|
||||
button_pause_resume = $%Button_Pause_Resume
|
||||
if radio.stream_paused:
|
||||
$Control/MarginContainer/VBoxContainer/Button_Pause_Resume.text = "Resume"
|
||||
button_pause_resume.text = "Resume"
|
||||
else:
|
||||
$Control/MarginContainer/VBoxContainer/Button_Pause_Resume.text = "Pause"
|
||||
button_pause_resume.text = "Pause"
|
||||
|
||||
|
||||
func _on_button_stop_pressed() -> void:
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
script = ExtResource("1_h5r8c")
|
||||
|
||||
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("1_8yomj")]
|
||||
unique_name_in_owner = true
|
||||
playlist = Array[AudioStream]([ExtResource("3_ltpvc")])
|
||||
|
||||
[node name="Control" type="Control" parent="." unique_id=1232082176]
|
||||
@@ -18,40 +19,70 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Control" unique_id=2102712226]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control" unique_id=2097365775]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
offset_left = 50.0
|
||||
offset_top = 50.0
|
||||
offset_right = 125.0
|
||||
offset_bottom = 221.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control/MarginContainer" unique_id=2097365775]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Button_Play" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=1422696340]
|
||||
[node name="Button_Play" type="Button" parent="Control/VBoxContainer" unique_id=1422696340]
|
||||
layout_mode = 2
|
||||
text = "Play"
|
||||
|
||||
[node name="Button_Pause_Resume" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=2016690081]
|
||||
[node name="Button_Pause_Resume" type="Button" parent="Control/VBoxContainer" unique_id=2016690081]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Pause"
|
||||
|
||||
[node name="Button_Stop" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=61861870]
|
||||
[node name="Button_Stop" type="Button" parent="Control/VBoxContainer" unique_id=61861870]
|
||||
layout_mode = 2
|
||||
text = "Stop"
|
||||
|
||||
[node name="Button_Next" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=957606385]
|
||||
[node name="Button_Next" type="Button" parent="Control/VBoxContainer" unique_id=957606385]
|
||||
layout_mode = 2
|
||||
text = "Next"
|
||||
|
||||
[node name="Button_Previous" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=929072518]
|
||||
[node name="Button_Previous" type="Button" parent="Control/VBoxContainer" unique_id=929072518]
|
||||
layout_mode = 2
|
||||
text = "Previous"
|
||||
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Play" to="." method="_on_button_play_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Pause_Resume" to="." method="_on_button_pause_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Stop" to="." method="_on_button_stop_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Next" to="." method="_on_button_next_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Previous" to="." method="_on_button_previous_pressed"]
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Control" unique_id=1558442050]
|
||||
layout_mode = 0
|
||||
offset_left = 50.0
|
||||
offset_top = 250.0
|
||||
offset_right = 400.0
|
||||
offset_bottom = 1027.0
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Control/PanelContainer" unique_id=7789304]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/PanelContainer/ScrollContainer" unique_id=2043293564]
|
||||
custom_minimum_size = Vector2(1, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "System Logic:
|
||||
- The system is an extension of AudioStreamPlayer designed to manage sequential audio playback.
|
||||
- It automatically triggers the next track in the sequence when the current one finishes via the finished signal.
|
||||
|
||||
Core Functionality:
|
||||
- Playlist Management: Stores a list of AudioStream resources and tracks the current song index.
|
||||
- Track Navigation: Allows cycling forward and backward through the playlist with index wrapping (loops back to start/end).
|
||||
- Playback Control: Supports jumping to specific tracks, toggling the pause state, and stopping the stream.
|
||||
|
||||
Key Methods:
|
||||
- play_track: Loads a specific stream from the playlist and begins playback.
|
||||
- next_track / prev_track: Increments or decrements the index to navigate the playlist.
|
||||
- toggle_pause: Resumes or pauses the current stream without resetting its position.
|
||||
|
||||
Adjustable Parameters:
|
||||
- Playlist: An Array in the inspector where you can assign multiple AudioStream resources (e.g., .mp3, .ogg).
|
||||
- Current Track Index: Determines which song starts playing by default."
|
||||
autowrap_mode = 2
|
||||
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Button_Play" to="." method="_on_button_play_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Button_Pause_Resume" to="." method="_on_button_pause_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Button_Stop" to="." method="_on_button_stop_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Button_Next" to="." method="_on_button_next_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Button_Previous" to="." method="_on_button_previous_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user