diff --git a/Prefabs/XROrigin.tscn b/Prefabs/XROrigin.tscn index 6d22471..e355446 100644 --- a/Prefabs/XROrigin.tscn +++ b/Prefabs/XROrigin.tscn @@ -6,18 +6,119 @@ [ext_resource type="PackedScene" uid="uid://b4ysuy43poobf" path="res://addons/godot-xr-tools/functions/function_pickup.tscn" id="3_rd8py"] [ext_resource type="PackedScene" uid="uid://diyu06cw06syv" path="res://addons/godot-xr-tools/player/player_body.tscn" id="4_6xr3x"] [ext_resource type="PackedScene" uid="uid://b6bk2pj8vbj28" path="res://addons/godot-xr-tools/functions/movement_turn.tscn" id="4_rd8py"] +[ext_resource type="PackedScene" uid="uid://cmxe1av5nsxyq" path="res://UI/shop_menu_3d.tscn" id="5_7rrtu"] [ext_resource type="PackedScene" uid="uid://cqhw276realc" path="res://addons/godot-xr-tools/functions/function_pointer.tscn" id="6_ptr"] +[ext_resource type="PackedScene" uid="uid://bjcxf427un2wp" path="res://addons/godot-xr-tools/player/poke/poke.tscn" id="7_1fmci"] + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1fmci"] +animation = &"Grip" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_73fu8"] +animation = &"Grip" + +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ouruy"] +filter_enabled = true +filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"] + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_i0gvw"] +animation = &"Grip 5" + +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_5mmou"] +filter_enabled = true +filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"] + +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_yfij0"] +graph_offset = Vector2(-536, 11) +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_1fmci") +nodes/ClosedHand1/position = Vector2(-600, 300) +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_73fu8") +nodes/ClosedHand2/position = Vector2(-360, 300) +nodes/Grip/node = SubResource("AnimationNodeBlend2_ouruy") +nodes/Grip/position = Vector2(0, 20) +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_i0gvw") +nodes/OpenHand/position = Vector2(-600, 100) +nodes/Trigger/node = SubResource("AnimationNodeBlend2_5mmou") +nodes/Trigger/position = Vector2(-360, 20) +node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1fmci"] +transparency = 1 +albedo_color = Color(1, 1, 1, 0.5882353) + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_itrmp"] +animation = &"Grip" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_nrfrd"] +animation = &"Grip" + +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_73fu8"] +filter_enabled = true +filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"] + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ouruy"] +animation = &"Grip 5" + +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_i0gvw"] +filter_enabled = true +filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"] + +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_5mmou"] +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_itrmp") +nodes/ClosedHand1/position = Vector2(-600, 300) +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_nrfrd") +nodes/ClosedHand2/position = Vector2(-360, 300) +nodes/Grip/node = SubResource("AnimationNodeBlend2_73fu8") +nodes/Grip/position = Vector2(0, 40) +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_ouruy") +nodes/OpenHand/position = Vector2(-600, 100) +nodes/Trigger/node = SubResource("AnimationNodeBlend2_i0gvw") +nodes/Trigger/position = Vector2(-360, 40) +node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"] [node name="XROrigin3D" type="XROrigin3D" unique_id=2055526621] [node name="XRCamera3D" type="XRCamera3D" parent="." unique_id=983614103] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.49626195, 0) [node name="XRControllerLeftHand" type="XRController3D" parent="." unique_id=1171100950] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 0, 0) tracker = &"left_hand" [node name="LeftHand" parent="XRControllerLeftHand" unique_id=1805508372 instance=ExtResource("1_jr1t4")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919) +[node name="Hand_low_L" parent="XRControllerLeftHand/LeftHand" index="0"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.01, 0, 0.05) + +[node name="Skeleton3D" parent="XRControllerLeftHand/LeftHand/Hand_low_L/Armature" index="0" unique_id=242151480] +bones/1/rotation = Quaternion(0.323537, -2.5658142e-05, -0.027220426, 0.9458239) +bones/2/rotation = Quaternion(-0.09044407, -0.04151748, -0.16629349, 0.98104167) +bones/3/rotation = Quaternion(-0.04661986, 0.02097099, 0.010327632, 0.9986392) +bones/5/rotation = Quaternion(-0.0012845465, -0.011608094, -0.016825877, 0.99979025) +bones/6/rotation = Quaternion(0.10292491, -0.009932083, -0.007944166, 0.9946078) +bones/7/rotation = Quaternion(-0.012859, -0.023610815, -0.32325828, 0.9459289) +bones/8/rotation = Quaternion(0.012057539, -0.009291937, -0.24747224, 0.96877545) +bones/10/rotation = Quaternion(-0.035753887, -0.0004000325, 0.0063676415, 0.9993403) +bones/11/rotation = Quaternion(-0.0026496367, -0.0011447113, -0.12599176, 0.9920271) +bones/12/rotation = Quaternion(0.039422527, 0.0019339261, -0.22807404, 0.97284347) +bones/13/rotation = Quaternion(-0.012339468, -0.008812943, -0.28066906, 0.9596848) +bones/15/rotation = Quaternion(-0.070265576, 0.010190836, -0.024330735, 0.9971795) +bones/16/rotation = Quaternion(-0.032063447, -0.002236244, -0.06863657, 0.99712384) +bones/17/rotation = Quaternion(0.025345208, 0.008124622, -0.2490055, 0.9681363) +bones/18/rotation = Quaternion(0.0025223217, 0.007880732, -0.2432038, 0.9699399) +bones/20/rotation = Quaternion(-0.09173688, 0.020302717, -0.010182976, 0.9955242) +bones/21/rotation = Quaternion(-0.06251818, -0.00022572002, -0.115392834, 0.99135065) +bones/22/rotation = Quaternion(0.058578636, 0.021648303, -0.26990518, 0.9608596) +bones/23/rotation = Quaternion(0.006871769, -0.0035727466, -0.21195254, 0.97724926) + +[node name="BoneAttachment3D" type="BoneAttachment3D" parent="XRControllerLeftHand/LeftHand/Hand_low_L/Armature/Skeleton3D" index="1" unique_id=506224189] +transform = Transform3D(0.5408296, 0.8408128, -0.023173608, -0.08262672, 0.08052427, 0.99332196, 0.83706397, -0.5353032, 0.11302349, 0.039901964, 0.040282845, -0.15009598) +bone_name = "Index_Tip_L" +bone_idx = 9 + +[node name="AnimationTree" parent="XRControllerLeftHand/LeftHand" index="1"] +tree_root = SubResource("AnimationNodeBlendTree_yfij0") + [node name="MovementDirect" parent="XRControllerLeftHand" unique_id=1865515938 instance=ExtResource("2_q1xvu")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919) strafe = true @@ -27,14 +128,57 @@ strafe = true [node name="FunctionPointer" parent="XRControllerLeftHand" unique_id=315304316 instance=ExtResource("6_ptr")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, 0.05, -0.1) show_laser = 2 +laser_length = 1 +laser_material = SubResource("StandardMaterial3D_1fmci") +laser_hit_material = SubResource("StandardMaterial3D_1fmci") show_target = true +target_radius = 0.009 +target_material = SubResource("StandardMaterial3D_1fmci") + +[node name="ShopMenu3D" parent="XRControllerLeftHand" unique_id=331240263 instance=ExtResource("5_7rrtu")] +transform = Transform3D(0.17921828, 0.016751308, -0.00045015282, -0.0125175975, 0.13704088, 0.116030626, 0.011140855, -0.11549542, 0.13761066, 0.27515364, 0.031010807, -0.013297826) [node name="XRControllerRightHand" type="XRController3D" parent="." unique_id=202756852] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6, 0, 0) tracker = &"right_hand" [node name="RightHand" parent="XRControllerRightHand" unique_id=1112462503 instance=ExtResource("2_gshht")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919) +[node name="Hand_low_R" parent="XRControllerRightHand/RightHand" index="0"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, 0, 0.05) + +[node name="Skeleton3D" parent="XRControllerRightHand/RightHand/Hand_low_R/Armature" index="0" unique_id=976194013] +bones/1/rotation = Quaternion(0.323537, 2.5658142e-05, 0.027220426, 0.9458239) +bones/2/rotation = Quaternion(-0.09044407, 0.04151748, 0.16629349, 0.98104167) +bones/3/rotation = Quaternion(-0.04661986, -0.020970985, -0.010327632, 0.9986392) +bones/5/rotation = Quaternion(-0.0012845465, 0.011608096, 0.01682588, 0.99979025) +bones/6/rotation = Quaternion(0.10292492, 0.009932085, 0.007944188, 0.9946078) +bones/7/rotation = Quaternion(-0.012859004, 0.023610815, 0.32325834, 0.94592875) +bones/8/rotation = Quaternion(0.012057537, 0.0092919255, 0.24747224, 0.96877545) +bones/10/rotation = Quaternion(-0.035753887, 0.00040003238, -0.0063676336, 0.9993403) +bones/11/rotation = Quaternion(-0.0026496367, 0.0011447114, 0.1259918, 0.9920271) +bones/12/rotation = Quaternion(0.03942253, -0.0019339275, 0.2280741, 0.97284347) +bones/13/rotation = Quaternion(-0.012339467, 0.008812944, 0.28066906, 0.9596848) +bones/15/rotation = Quaternion(-0.07026557, -0.010190836, 0.024330745, 0.99717957) +bones/16/rotation = Quaternion(-0.032063447, 0.002236245, 0.06863657, 0.99712384) +bones/17/rotation = Quaternion(0.025345206, -0.00812462, 0.24900547, 0.9681363) +bones/18/rotation = Quaternion(0.0025223275, -0.007880732, 0.24320383, 0.9699399) +bones/20/rotation = Quaternion(-0.09173688, -0.020302719, 0.010182976, 0.9955242) +bones/21/rotation = Quaternion(-0.06251817, 0.00022572096, 0.115392834, 0.99135065) +bones/22/rotation = Quaternion(0.058578644, -0.021648303, 0.26990518, 0.9608596) +bones/23/rotation = Quaternion(0.0068717655, 0.0035727452, 0.21195254, 0.97724926) + +[node name="BoneAttachment3D" type="BoneAttachment3D" parent="XRControllerRightHand/RightHand/Hand_low_R/Armature/Skeleton3D" index="1" unique_id=497290142] +transform = Transform3D(0.5408295, -0.8408129, 0.023173586, 0.08262676, 0.08052423, 0.99332196, -0.83706397, -0.53530306, 0.11302352, -0.03990197, 0.040282845, -0.15009597) +bone_name = "Index_Tip_R" +bone_idx = 9 + +[node name="Poke" parent="XRControllerRightHand/RightHand/Hand_low_R/Armature/Skeleton3D/BoneAttachment3D" unique_id=303927399 instance=ExtResource("7_1fmci")] + +[node name="AnimationTree" parent="XRControllerRightHand/RightHand" index="1"] +tree_root = SubResource("AnimationNodeBlendTree_5mmou") + [node name="MovementTurn" parent="XRControllerRightHand" unique_id=154529119 instance=ExtResource("4_rd8py")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919) turn_mode = 2 @@ -45,8 +189,21 @@ smooth_turn_speed = 3.5 [node name="FunctionPointer" parent="XRControllerRightHand" unique_id=2017919314 instance=ExtResource("6_ptr")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, 0.05, -0.1) show_laser = 2 +laser_length = 1 +laser_material = SubResource("StandardMaterial3D_1fmci") +laser_hit_material = SubResource("StandardMaterial3D_1fmci") show_target = true +target_radius = 0.009 +target_material = SubResource("StandardMaterial3D_1fmci") + +[node name="ShopMenu3D" parent="XRControllerRightHand" unique_id=246744456 instance=ExtResource("5_7rrtu")] +transform = Transform3D(0.17912053, -0.017761359, -0.0006130421, 0.014117808, 0.138435, 0.11417722, -0.010794867, -0.11366743, 0.13915166, -0.11845571, 0.038174443, -0.038154215) [node name="PlayerBody" parent="." unique_id=1444632058 instance=ExtResource("4_6xr3x")] collision_mask = 1017 player_calibrate_height = false + +[editable path="XRControllerLeftHand/LeftHand"] +[editable path="XRControllerLeftHand/LeftHand/Hand_low_L"] +[editable path="XRControllerRightHand/RightHand"] +[editable path="XRControllerRightHand/RightHand/Hand_low_R"] diff --git a/Scenes/JonScene.tscn b/Scenes/JonScene.tscn index 12c0a7a..fdc348a 100644 --- a/Scenes/JonScene.tscn +++ b/Scenes/JonScene.tscn @@ -25,7 +25,6 @@ [ext_resource type="PackedScene" uid="uid://dgk88esxip5xi" path="res://items/knife.tscn" id="23_qxyk8"] [ext_resource type="PackedScene" uid="uid://drwuhqb3pjtiy" path="res://items/potato.tscn" id="24_u5c1m"] [ext_resource type="PackedScene" uid="uid://bpvp20hiagxxb" path="res://items/chopped_potato.tscn" id="25_y7baw"] -[ext_resource type="PackedScene" uid="uid://cmxe1av5nsxyq" path="res://UI/shop_menu_3d.tscn" id="26_qxyk8"] [sub_resource type="Environment" id="Environment_bvwq1"] background_mode = 2 @@ -74,7 +73,7 @@ script = ExtResource("1_57ppd") environment = SubResource("Environment_bvwq1") [node name="XROrigin3D" parent="." unique_id=2055526621 groups=["local_xr_origin"] instance=ExtResource("2_o1b3t")] -transform = Transform3D(1.3113416e-07, 0, 1, 0, 1, 0, -1, 0, 1.3113416e-07, -1.2943892, 0.9667189, 4.698895) +transform = Transform3D(1.3113416e-07, 0, 1, 0, 1, 0, -1, 0, 1.3113416e-07, -2.4543328, 1.247834, 4.698895) [node name="WorldContent" type="Node3D" parent="." unique_id=262398468] @@ -490,6 +489,3 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.96, 1.1400001, 1.6800001) [node name="Chips2" parent="." unique_id=2054749156 instance=ExtResource("22_2ndvi")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.9600003, 1.1400001, 1.08) - -[node name="ShopMenu3D" parent="." unique_id=331240263 instance=ExtResource("26_qxyk8")] -transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -3.9984353, 1.0982544, 4.0508556) diff --git a/Scenes/test_small.tscn b/Scenes/test_small.tscn index 38c7fa8..0dd21cb 100644 --- a/Scenes/test_small.tscn +++ b/Scenes/test_small.tscn @@ -11,7 +11,6 @@ [ext_resource type="Script" uid="uid://bsdpd18i1i17s" path="res://prefabs/build_mode_controller.gd" id="9_atgwk"] [ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://stations/sink.tscn" id="10_dhas4"] [ext_resource type="PackedScene" uid="uid://caf0xanmxbshy" path="res://stations/table.tscn" id="11_gaw43"] -[ext_resource type="PackedScene" uid="uid://cmxe1av5nsxyq" path="res://UI/shop_menu_3d.tscn" id="12_o0gyi"] [sub_resource type="Environment" id="Environment_bvwq1"] background_mode = 2 @@ -35,9 +34,6 @@ size = Vector3(20, 0.1, 20) [sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"] size = Vector3(20, 10, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_o0gyi"] -viewport_path = NodePath("SubViewport") - [node name="Main" type="Node3D" unique_id=1312265607] script = ExtResource("1_atgwk") @@ -111,17 +107,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6, 0, 0) script = ExtResource("9_atgwk") [node name="Sink" parent="." unique_id=1559059799 instance=ExtResource("10_dhas4")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.4, 0.5, 0.6) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.2, 0.5, 0) [node name="Table" parent="." unique_id=1863572470 instance=ExtResource("11_gaw43")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.4, 0.5, 1.8) - -[node name="Shopmenu" parent="." unique_id=938821446 instance=ExtResource("12_o0gyi")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.2, 1.1818607, 0.4109261) -texture = SubResource("ViewportTexture_o0gyi") - -[node name="Counter2" parent="." unique_id=672880121 instance=ExtResource("7_jnxsa")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.6000004, 0.6, -1.2) - -[node name="Hob2" parent="." unique_id=172418174 instance=ExtResource("5_gfdi7")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.8, 0.6, -1.2) diff --git a/UI/shop.tscn b/UI/shop.tscn index 13970c9..a8d24a3 100644 --- a/UI/shop.tscn +++ b/UI/shop.tscn @@ -36,7 +36,7 @@ offset_top = 20.0 offset_right = -20.0 grow_horizontal = 0 pivot_offset_ratio = Vector2(1, 0) -text = "X $" +text = "9999 $" label_settings = SubResource("LabelSettings_vlqg6") horizontal_alignment = 2 @@ -49,9 +49,10 @@ offset_left = 20.0 offset_top = 80.0 offset_right = -20.0 offset_bottom = -20.0 -current_tab = 0 +current_tab = 1 [node name="Stations" type="GridContainer" parent="TabContainer" unique_id=189446761] +visible = false layout_mode = 2 columns = 6 metadata/_tab_index = 0 @@ -267,7 +268,6 @@ station_name = "Sink" cost = 40 [node name="Food" type="GridContainer" parent="TabContainer" unique_id=422899445] -visible = false layout_mode = 2 columns = 6 metadata/_tab_index = 1 diff --git a/UI/shop_menu_3d.tscn b/UI/shop_menu_3d.tscn index 91eca8a..e15a0f1 100644 --- a/UI/shop_menu_3d.tscn +++ b/UI/shop_menu_3d.tscn @@ -7,7 +7,8 @@ transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 0, 0) [node name="Viewport2Din3D" parent="." unique_id=651579338 instance=ExtResource("1_qtkxm")] +collision_layer = 5242880 scene = ExtResource("1_e5js8") -viewport_size = Vector2(1185.485, 733.795) +viewport_size = Vector2(807.655, 559.085) transparent = 1 scene_properties_keys = PackedStringArray("shop_ui.gd") diff --git a/UI/shop_station_button.gd b/UI/shop_station_button.gd index 2f8693c..286dbba 100644 --- a/UI/shop_station_button.gd +++ b/UI/shop_station_button.gd @@ -19,3 +19,7 @@ func _ready() -> void: func _on_button_pressed() -> void: print("ShopStationButton buy ", station_name) + +func _process(_delta: float) -> void: + button.disabled = GameManager.money < cost + diff --git a/UI/shop_station_panel.tscn b/UI/shop_station_panel.tscn index 4769c36..e3a1b2b 100644 --- a/UI/shop_station_panel.tscn +++ b/UI/shop_station_panel.tscn @@ -30,13 +30,9 @@ button = NodePath("Button") [node name="Button" type="Button" parent="." unique_id=1482490300] layout_mode = 1 -anchors_preset = -1 +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = 3.0 -offset_top = 3.0 -offset_right = -3.0 -offset_bottom = -3.0 grow_horizontal = 2 grow_vertical = 2 icon = ExtResource("2_e1k4i") diff --git a/UI/shop_ui.gd b/UI/shop_ui.gd index 898150c..6d311ab 100644 --- a/UI/shop_ui.gd +++ b/UI/shop_ui.gd @@ -1,12 +1,63 @@ +class_name ShopUI extends Panel @onready var money_label: Label = $Money -# Called when the node enters the scene tree for the first time. +var controller: XRController3D = null +const INPUT_TOGGLE_COOLDOWN := 0.15 + +var enabled: bool = false: set = _set_enabled + +var _last_toggle_time := 0.0 +var viewport: XRToolsViewport2DIn3D + func _ready() -> void: - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: + detect_hand_from_xr_ancestor() + if controller: + controller.button_pressed.connect(_on_tracker_button_pressed) + viewport = get_parent().get_parent() as XRToolsViewport2DIn3D + if not viewport: + push_error("Shop UI could not find XRToolsViewport2DIn3D grand parent") + enabled = false + + +func _process(_delta: float) -> void: money_label.text = str(GameManager.money) + "$" + + +func toggle_shop(): + if GameManager.game_state == GameManager.GameState.BUILDING: + print("Shop UI toggle shop") + enabled = !enabled + + +func _set_enabled(value: bool) -> void: + enabled = value + visible = value + viewport.enabled = value + + +func _on_tracker_button_pressed(button_name: String) -> void: + print("Shop _on_tracker_button_pressed, button: ", button_name) + var now := Time.get_ticks_msec() / 1000.0 + if now - _last_toggle_time < INPUT_TOGGLE_COOLDOWN: + return + + _last_toggle_time = now + if button_name == "ax_button": + toggle_shop() + + +func detect_hand_from_xr_ancestor() -> void: + var curr: Node = get_parent() + # Climb up the tree until we find an XRNode3D/XRController3D or hit root + while curr != null: + if curr is XRController3D: + controller = curr + break + curr = curr.get_parent() + + if not controller: + push_error("Shop UI could not find XRController3D ancestor") + else: + print ("Shop UI detected hand: ", controller.get_tracker_hand()) diff --git a/documentation/Notes.md b/documentation/Notes.md index 588b8b6..851b2f2 100644 --- a/documentation/Notes.md +++ b/documentation/Notes.md @@ -26,6 +26,7 @@ splitter mixer blender dishwasher +flinger / catapult ## Storage shelf @@ -50,3 +51,11 @@ belts share inventory tables share +Shared INventory + Raycasts[] + Area3D + + list + + + diff --git a/global/GameManager.gd b/global/GameManager.gd index 0ee738e..5de0ba5 100644 --- a/global/GameManager.gd +++ b/global/GameManager.gd @@ -1,7 +1,7 @@ class_name GameManager extends Node -static var money: int = 20 +static var money: int = 35 static var meals_in_play: Array[String] static var sides_in_play: Array[String] diff --git a/global/global_key_events.gd b/global/global_key_events.gd index 3701551..80c0dac 100644 --- a/global/global_key_events.gd +++ b/global/global_key_events.gd @@ -9,6 +9,8 @@ func _unhandled_input(event: InputEvent) -> void: set_buidling_mode() if event.is_action_pressed("set_running_mode"): set_running_mode() + if event.is_action_pressed("set_game_over"): + set_game_over() # Finds any node of class/type Table and calls satisfyAllOrders() @@ -29,3 +31,7 @@ func set_buidling_mode(): func set_running_mode(): print("Global key event: Setting running mode") GameManager.game_state = GameManager.GameState.RUNNING + +func set_game_over(): + print("Global key event: Setting game over") + GameManager.game_state = GameManager.GameState.GAME_OVER diff --git a/project.godot b/project.godot index ce233c9..a4e67b5 100644 --- a/project.godot +++ b/project.godot @@ -72,6 +72,11 @@ set_running_mode={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":44,"key_label":0,"unicode":44,"location":0,"echo":false,"script":null) ] } +set_game_over={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":47,"key_label":0,"unicode":45,"location":0,"echo":false,"script":null) +] +} [layer_names]