add vr template project
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://b64v7w5y3yghi"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://qbmx03iibuuu" path="res://addons/godot-xr-tools/staging/scene_base.tscn" id="1_2sv0p"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqhw276realc" path="res://addons/godot-xr-tools/functions/function_pointer.tscn" id="3_du2hn"]
|
||||
[ext_resource type="PackedScene" uid="uid://b4kad2kuba1yn" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/left_hand_low.tscn" id="3_rfr2t"]
|
||||
[ext_resource type="Material" uid="uid://ccdofvku4c7w3" path="res://assets/prototype_materials/stone_grey.tres" id="3_uwduq"]
|
||||
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="4_7pgy0"]
|
||||
[ext_resource type="PackedScene" uid="uid://l2n30mpbkdyw" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/right_hand_low.tscn" id="5_5cr7c"]
|
||||
[ext_resource type="PackedScene" uid="uid://cl8q8f32imusk" path="res://game/start_scene/start_ui.tscn" id="5_grt1o"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_oplr7"]
|
||||
ambient_light_source = 1
|
||||
reflected_light_source = 1
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_vi1r3"]
|
||||
material = ExtResource("3_uwduq")
|
||||
size = Vector2(12, 12)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_3ap0s"]
|
||||
size = Vector3(12, 1, 12)
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_l0e1e"]
|
||||
material = ExtResource("3_uwduq")
|
||||
size = Vector2(12, 4)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_w6gh2"]
|
||||
size = Vector3(12, 4, 1)
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_44p7b"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(3, 2)
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_2wivy"]
|
||||
viewport_path = NodePath("Viewport")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tmib1"]
|
||||
transparency = 1
|
||||
cull_mode = 2
|
||||
shading_mode = 0
|
||||
albedo_texture = SubResource("ViewportTexture_2wivy")
|
||||
texture_filter = 1
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_iru2p"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(3, 2, 0.02)
|
||||
|
||||
[node name="StartZone" instance=ExtResource("1_2sv0p")]
|
||||
|
||||
[node name="XROrigin3D" parent="." index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3)
|
||||
|
||||
[node name="LeftHand" parent="XROrigin3D/LeftHand" index="0" instance=ExtResource("3_rfr2t")]
|
||||
|
||||
[node name="FunctionPointer" parent="XROrigin3D/LeftHand" index="1" instance=ExtResource("3_du2hn")]
|
||||
show_laser = 2
|
||||
laser_length = 1
|
||||
|
||||
[node name="RightHand" parent="XROrigin3D/RightHand" index="0" instance=ExtResource("5_5cr7c")]
|
||||
|
||||
[node name="FunctionPointer" parent="XROrigin3D/RightHand" index="1" instance=ExtResource("3_du2hn")]
|
||||
show_laser = 2
|
||||
laser_length = 1
|
||||
|
||||
[node name="World" type="Node3D" parent="." index="1"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="World" index="0"]
|
||||
environment = SubResource("Environment_oplr7")
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="World" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.5, 0)
|
||||
omni_range = 12.0
|
||||
|
||||
[node name="Ground" type="StaticBody3D" parent="World" index="2"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="World/Ground" index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
mesh = SubResource("QuadMesh_vi1r3")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Ground" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
|
||||
shape = SubResource("BoxShape3D_3ap0s")
|
||||
|
||||
[node name="Wall1" type="StaticBody3D" parent="World" index="3"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, -5)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="World/Wall1" index="0"]
|
||||
mesh = SubResource("QuadMesh_l0e1e")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Wall1" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
|
||||
shape = SubResource("BoxShape3D_w6gh2")
|
||||
|
||||
[node name="Wall2" type="StaticBody3D" parent="World" index="4"]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 5, 2, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="World/Wall2" index="0"]
|
||||
mesh = SubResource("QuadMesh_l0e1e")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Wall2" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
|
||||
shape = SubResource("BoxShape3D_w6gh2")
|
||||
|
||||
[node name="Wall3" type="StaticBody3D" parent="World" index="5"]
|
||||
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 2, 5)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="World/Wall3" index="0"]
|
||||
mesh = SubResource("QuadMesh_l0e1e")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Wall3" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
|
||||
shape = SubResource("BoxShape3D_w6gh2")
|
||||
|
||||
[node name="Wall4" type="StaticBody3D" parent="World" index="6"]
|
||||
transform = Transform3D(1.31134e-07, 0, 1, 0, 1, 0, -1, 0, 1.31134e-07, -5, 2, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="World/Wall4" index="0"]
|
||||
mesh = SubResource("QuadMesh_l0e1e")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Wall4" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
|
||||
shape = SubResource("BoxShape3D_w6gh2")
|
||||
|
||||
[node name="Ceiling" type="StaticBody3D" parent="World" index="7"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="World/Ceiling" index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
|
||||
mesh = SubResource("QuadMesh_vi1r3")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Ceiling" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||
shape = SubResource("BoxShape3D_3ap0s")
|
||||
|
||||
[node name="Screen" parent="." index="2" instance=ExtResource("4_7pgy0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, -3)
|
||||
update_mode = 2
|
||||
throttle_fps = 15.0
|
||||
unshaded = true
|
||||
|
||||
[node name="StartUI" parent="Screen/Viewport" index="0" instance=ExtResource("5_grt1o")]
|
||||
|
||||
[node name="Screen" parent="Screen" index="1"]
|
||||
mesh = SubResource("QuadMesh_44p7b")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_tmib1")
|
||||
|
||||
[node name="CollisionShape3D" parent="Screen/StaticBody3D" index="0"]
|
||||
shape = SubResource("BoxShape3D_iru2p")
|
||||
|
||||
[editable path="Screen"]
|
||||
@@ -0,0 +1,65 @@
|
||||
extends CenterContainer
|
||||
|
||||
@onready var save_list_node = $LoadGame/SaveList
|
||||
var save_list : Array
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
_set_pane(1)
|
||||
|
||||
# Get our list of save games
|
||||
if PersistentWorld.instance:
|
||||
save_list = PersistentWorld.instance.list_saves()
|
||||
|
||||
save_list_node.clear()
|
||||
for entry in save_list:
|
||||
save_list_node.add_item(entry)
|
||||
|
||||
$MainMenu/LoadGameBtn.disabled = save_list.size() == 0
|
||||
|
||||
func _set_pane(p_no):
|
||||
$MainMenu.visible = p_no == 1
|
||||
$NewGame.visible = p_no == 2
|
||||
$LoadGame.visible = p_no == 3
|
||||
$Options.visible = p_no == 4
|
||||
|
||||
# Main menu
|
||||
|
||||
func _on_new_game_btn_pressed():
|
||||
_set_pane(2)
|
||||
|
||||
func _on_load_game_btn_pressed():
|
||||
_set_pane(3)
|
||||
|
||||
func _on_options_btn_pressed():
|
||||
_set_pane(4)
|
||||
|
||||
func _on_exit_btn_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
# New game
|
||||
|
||||
func _on_easy_btn_pressed():
|
||||
GameState.new_game(GameState.GameDifficulty.GAME_EASY)
|
||||
|
||||
func _on_normal_btn_pressed():
|
||||
GameState.new_game(GameState.GameDifficulty.GAME_NORMAL)
|
||||
|
||||
func _on_hard_btn_pressed():
|
||||
GameState.new_game(GameState.GameDifficulty.GAME_HARD)
|
||||
|
||||
func _on_back_btn_pressed():
|
||||
_set_pane(1)
|
||||
|
||||
# Load game
|
||||
|
||||
func _on_start_button_pressed():
|
||||
var selected_items = save_list_node.get_selected_items()
|
||||
if selected_items.size() == 1:
|
||||
# Should be only one!
|
||||
var selected_item = selected_items[0]
|
||||
print("Selected item: ", selected_item)
|
||||
|
||||
var save_name = save_list[selected_item]
|
||||
print("Loading save: ", save_name)
|
||||
GameState.load_game(save_name)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cck20btlm3owa
|
||||
@@ -0,0 +1,107 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cl8q8f32imusk"]
|
||||
|
||||
[ext_resource type="Script" path="res://game/start_scene/start_ui.gd" id="1_n87es"]
|
||||
|
||||
[node name="StartUI" type="CenterContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource("1_n87es")
|
||||
|
||||
[node name="MainMenu" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="NewGameBtn" type="Button" parent="MainMenu"]
|
||||
layout_mode = 2
|
||||
text = "New game"
|
||||
|
||||
[node name="LoadGameBtn" type="Button" parent="MainMenu"]
|
||||
layout_mode = 2
|
||||
text = "Load game
|
||||
"
|
||||
|
||||
[node name="OptionsBtn" type="Button" parent="MainMenu"]
|
||||
layout_mode = 2
|
||||
text = "Options
|
||||
"
|
||||
|
||||
[node name="ExitBtn" type="Button" parent="MainMenu"]
|
||||
layout_mode = 2
|
||||
text = "Quit"
|
||||
|
||||
[node name="NewGame" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="EasyBtn" type="Button" parent="NewGame"]
|
||||
layout_mode = 2
|
||||
text = "Easy
|
||||
"
|
||||
|
||||
[node name="NormalBtn" type="Button" parent="NewGame"]
|
||||
layout_mode = 2
|
||||
text = "Normal"
|
||||
|
||||
[node name="HardBtn" type="Button" parent="NewGame"]
|
||||
layout_mode = 2
|
||||
text = "Hard"
|
||||
|
||||
[node name="BackBtn" type="Button" parent="NewGame"]
|
||||
layout_mode = 2
|
||||
text = "Back"
|
||||
|
||||
[node name="LoadGame" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 5
|
||||
|
||||
[node name="Label" type="Label" parent="LoadGame"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Load/Save Not Implemented in Demo"
|
||||
|
||||
[node name="SaveList" type="ItemList" parent="LoadGame"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_font_sizes/font_size = 20
|
||||
auto_height = true
|
||||
item_count = 4
|
||||
item_0/text = "Save Slot - 1"
|
||||
item_1/text = "Save Slot - 2"
|
||||
item_2/text = "Save Slot - 3"
|
||||
item_3/text = "Save Slot - 4"
|
||||
|
||||
[node name="StartBtn" type="Button" parent="LoadGame"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 25
|
||||
text = "Start"
|
||||
|
||||
[node name="BackBtn" type="Button" parent="LoadGame"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 25
|
||||
text = "Back "
|
||||
|
||||
[node name="Options" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BackBtn" type="Button" parent="Options"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 25
|
||||
text = "Back "
|
||||
|
||||
[connection signal="pressed" from="MainMenu/NewGameBtn" to="." method="_on_new_game_btn_pressed"]
|
||||
[connection signal="pressed" from="MainMenu/LoadGameBtn" to="." method="_on_load_game_btn_pressed"]
|
||||
[connection signal="pressed" from="MainMenu/OptionsBtn" to="." method="_on_options_btn_pressed"]
|
||||
[connection signal="pressed" from="MainMenu/ExitBtn" to="." method="_on_exit_btn_pressed"]
|
||||
[connection signal="pressed" from="NewGame/EasyBtn" to="." method="_on_easy_btn_pressed"]
|
||||
[connection signal="pressed" from="NewGame/NormalBtn" to="." method="_on_normal_btn_pressed"]
|
||||
[connection signal="pressed" from="NewGame/HardBtn" to="." method="_on_hard_btn_pressed"]
|
||||
[connection signal="pressed" from="NewGame/BackBtn" to="." method="_on_back_btn_pressed"]
|
||||
[connection signal="pressed" from="LoadGame/StartBtn" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="LoadGame/BackBtn" to="." method="_on_back_btn_pressed"]
|
||||
[connection signal="pressed" from="Options/BackBtn" to="." method="_on_back_btn_pressed"]
|
||||
Reference in New Issue
Block a user