add sound effects, clean up code
This commit is contained in:
parent
eb5b869809
commit
5ffbc6d3f2
BIN
app/assets/sound/analog-appliance-button.mp3
Normal file
BIN
app/assets/sound/analog-appliance-button.mp3
Normal file
Binary file not shown.
19
app/assets/sound/analog-appliance-button.mp3.import
Normal file
19
app/assets/sound/analog-appliance-button.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://cxhsv4h1q8pm7"
|
||||||
|
path="res://.godot/imported/analog-appliance-button.mp3-3400d402b6dbe616a93c6ce4dfd33aab.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sound/analog-appliance-button.mp3"
|
||||||
|
dest_files=["res://.godot/imported/analog-appliance-button.mp3-3400d402b6dbe616a93c6ce4dfd33aab.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
BIN
app/assets/sound/camera-shutter.mp3
Normal file
BIN
app/assets/sound/camera-shutter.mp3
Normal file
Binary file not shown.
19
app/assets/sound/camera-shutter.mp3.import
Normal file
19
app/assets/sound/camera-shutter.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://c0ffdufx3cgg2"
|
||||||
|
path="res://.godot/imported/camera-shutter.mp3-09c4e70bc95a3baac5e36d55131e6433.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sound/camera-shutter.mp3"
|
||||||
|
dest_files=["res://.godot/imported/camera-shutter.mp3-09c4e70bc95a3baac5e36d55131e6433.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
BIN
app/assets/sound/crumple.mp3
Normal file
BIN
app/assets/sound/crumple.mp3
Normal file
Binary file not shown.
19
app/assets/sound/crumple.mp3.import
Normal file
19
app/assets/sound/crumple.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://bm2uxwqfmnvs6"
|
||||||
|
path="res://.godot/imported/crumple.mp3-9a9f9e732def4983e19646093aa79cb8.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sound/crumple.mp3"
|
||||||
|
dest_files=["res://.godot/imported/crumple.mp3-9a9f9e732def4983e19646093aa79cb8.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
BIN
app/assets/sound/finger-snap.mp3
Normal file
BIN
app/assets/sound/finger-snap.mp3
Normal file
Binary file not shown.
19
app/assets/sound/finger-snap.mp3.import
Normal file
19
app/assets/sound/finger-snap.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://du7ur0lu28cvn"
|
||||||
|
path="res://.godot/imported/finger-snap.mp3-ee69ae79e1da4049d24dd085be327ce3.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sound/finger-snap.mp3"
|
||||||
|
dest_files=["res://.godot/imported/finger-snap.mp3-ee69ae79e1da4049d24dd085be327ce3.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
BIN
app/assets/sound/message-incoming.mp3
Normal file
BIN
app/assets/sound/message-incoming.mp3
Normal file
Binary file not shown.
19
app/assets/sound/message-incoming.mp3.import
Normal file
19
app/assets/sound/message-incoming.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://c0fj5p6544ab7"
|
||||||
|
path="res://.godot/imported/message-incoming.mp3-f3b0b0d850f78a95341ef72186559e01.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sound/message-incoming.mp3"
|
||||||
|
dest_files=["res://.godot/imported/message-incoming.mp3-f3b0b0d850f78a95341ef72186559e01.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
|
@ -14,6 +14,7 @@ const color_wheel_img := preload ("res://assets/canvas.png")
|
||||||
@onready var mode_next = $Modes/Next
|
@onready var mode_next = $Modes/Next
|
||||||
@onready var mode_before = $Modes/Previous
|
@onready var mode_before = $Modes/Previous
|
||||||
@onready var mode_label = $Modes/Label
|
@onready var mode_label = $Modes/Label
|
||||||
|
@onready var snap_sound = $SnapSound
|
||||||
|
|
||||||
var active = R.state(false)
|
var active = R.state(false)
|
||||||
var brightness = R.state(0) # 0-255
|
var brightness = R.state(0) # 0-255
|
||||||
|
@ -78,6 +79,8 @@ func _ready():
|
||||||
"rgb_color": [int(picked_color.r * 255), int(picked_color.g * 255), int(picked_color.b * 255)],
|
"rgb_color": [int(picked_color.r * 255), int(picked_color.g * 255), int(picked_color.b * 255)],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snap_sound.play()
|
||||||
|
|
||||||
HomeApi.set_state(entity_id, "on", attributes)
|
HomeApi.set_state(entity_id, "on", attributes)
|
||||||
)
|
)
|
||||||
color_supported = true
|
color_supported = true
|
||||||
|
@ -123,6 +126,7 @@ func set_state(stateInfo):
|
||||||
|
|
||||||
func _on_click(event):
|
func _on_click(event):
|
||||||
if event.target == self:
|
if event.target == self:
|
||||||
|
snap_sound.play()
|
||||||
_toggle()
|
_toggle()
|
||||||
|
|
||||||
func quick_action():
|
func quick_action():
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=14 format=3 uid="uid://cw86rc42dv2d8"]
|
[gd_scene load_steps=15 format=3 uid="uid://cw86rc42dv2d8"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/entities/light/light.gd" id="1_ykxy3"]
|
[ext_resource type="Script" path="res://content/entities/light/light.gd" id="1_ykxy3"]
|
||||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_4sfxb"]
|
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_4sfxb"]
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="6_mhjlm"]
|
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="6_mhjlm"]
|
||||||
[ext_resource type="Texture2D" uid="uid://hy2f6is7qjyv" path="res://assets/canvas.png" id="7_ximu1"]
|
[ext_resource type="Texture2D" uid="uid://hy2f6is7qjyv" path="res://assets/canvas.png" id="7_ximu1"]
|
||||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="8_1sfll"]
|
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="8_1sfll"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://du7ur0lu28cvn" path="res://assets/sound/finger-snap.mp3" id="8_3togy"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="8_nhcff"]
|
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="8_nhcff"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
||||||
|
@ -105,3 +106,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.01, 0, 0)
|
||||||
pixel_size = 0.001
|
pixel_size = 0.001
|
||||||
text = "Default"
|
text = "Default"
|
||||||
horizontal_alignment = 0
|
horizontal_alignment = 0
|
||||||
|
|
||||||
|
[node name="SnapSound" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("8_3togy")
|
||||||
|
volume_db = -20.0
|
||||||
|
|
|
@ -3,6 +3,7 @@ extends Entity
|
||||||
const Entity = preload ("../entity.gd")
|
const Entity = preload ("../entity.gd")
|
||||||
|
|
||||||
@onready var sprite: AnimatedSprite3D = $Icon
|
@onready var sprite: AnimatedSprite3D = $Icon
|
||||||
|
@onready var snap_sound = $SnapSound
|
||||||
|
|
||||||
var active = R.state(false)
|
var active = R.state(false)
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ func set_state(stateInfo):
|
||||||
icon.value = "toggle_" + stateInfo["state"]
|
icon.value = "toggle_" + stateInfo["state"]
|
||||||
|
|
||||||
func _on_click(_event):
|
func _on_click(_event):
|
||||||
|
snap_sound.play()
|
||||||
_toggle()
|
_toggle()
|
||||||
|
|
||||||
func quick_action():
|
func quick_action():
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://cscl5k7lhopj5"]
|
[gd_scene load_steps=8 format=3 uid="uid://cscl5k7lhopj5"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/entities/switch/switch.gd" id="1_8ffhi"]
|
[ext_resource type="Script" path="res://content/entities/switch/switch.gd" id="1_8ffhi"]
|
||||||
[ext_resource type="Texture2D" uid="uid://br3p0c2foputg" path="res://assets/materials/swich_on.png" id="1_w68gw"]
|
[ext_resource type="Texture2D" uid="uid://br3p0c2foputg" path="res://assets/materials/swich_on.png" id="1_w68gw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://co2ishj2hx57p" path="res://assets/materials/switch_off.png" id="2_86ba1"]
|
[ext_resource type="Texture2D" uid="uid://co2ishj2hx57p" path="res://assets/materials/switch_off.png" id="2_86ba1"]
|
||||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_6xr03"]
|
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_6xr03"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://du7ur0lu28cvn" path="res://assets/sound/finger-snap.mp3" id="5_qvw3h"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
||||||
radius = 0.0482081
|
radius = 0.0482081
|
||||||
|
@ -37,3 +38,7 @@ sprite_frames = SubResource("SpriteFrames_ldpuo")
|
||||||
[node name="Movable" type="Node" parent="."]
|
[node name="Movable" type="Node" parent="."]
|
||||||
script = ExtResource("4_6xr03")
|
script = ExtResource("4_6xr03")
|
||||||
resizable = true
|
resizable = true
|
||||||
|
|
||||||
|
[node name="SnapSound" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("5_qvw3h")
|
||||||
|
volume_db = -20.0
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_3qyo4"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_3qyo4"]
|
||||||
size = Vector3(0.32, 0.16, 0.02)
|
size = Vector3(0.32, 0.16, 0.02)
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_nktla"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mb0u1"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
render_priority = 10
|
render_priority = 10
|
||||||
shader = ExtResource("6_40cd1")
|
shader = ExtResource("6_40cd1")
|
||||||
|
@ -25,7 +25,7 @@ shader_parameter/corner_radius = 0.8
|
||||||
shader_parameter/roughness = 0.3
|
shader_parameter/roughness = 0.3
|
||||||
shader_parameter/grain_amount = 0.02
|
shader_parameter/grain_amount = 0.02
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_mqjqg"]
|
[sub_resource type="QuadMesh" id="QuadMesh_ysurb"]
|
||||||
size = Vector2(0.32, 0.16)
|
size = Vector2(0.32, 0.16)
|
||||||
|
|
||||||
[node name="Timer" type="StaticBody3D" groups=["entity"]]
|
[node name="Timer" type="StaticBody3D" groups=["entity"]]
|
||||||
|
@ -78,7 +78,7 @@ label = "stop"
|
||||||
icon = true
|
icon = true
|
||||||
|
|
||||||
[node name="Panel" parent="." instance=ExtResource("5_j3gsb")]
|
[node name="Panel" parent="." instance=ExtResource("5_j3gsb")]
|
||||||
material_override = SubResource("ShaderMaterial_nktla")
|
material_override = SubResource("ShaderMaterial_mb0u1")
|
||||||
mesh = SubResource("QuadMesh_mqjqg")
|
mesh = SubResource("QuadMesh_ysurb")
|
||||||
size = Vector2(0.32, 0.16)
|
size = Vector2(0.32, 0.16)
|
||||||
corner_radius = 0.8
|
corner_radius = 0.8
|
||||||
|
|
|
@ -48,9 +48,6 @@ func _ready():
|
||||||
toggle_menu()
|
toggle_menu()
|
||||||
elif action.name == "by_button":
|
elif action.name == "by_button":
|
||||||
House.body.mini_view.small.value=!House.body.mini_view.small.value
|
House.body.mini_view.small.value=!House.body.mini_view.small.value
|
||||||
elif action.name == "ax_button":
|
|
||||||
if take_screenshot():
|
|
||||||
EventSystem.notify("Screenshot taken", EventNotify.Type.INFO)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
EventSystem.on_focus_in.connect(func(event):
|
EventSystem.on_focus_in.connect(func(event):
|
||||||
|
@ -125,9 +122,6 @@ func _input(event):
|
||||||
var vp = get_viewport()
|
var vp = get_viewport()
|
||||||
vp.debug_draw = (vp.debug_draw + 1) % 5
|
vp.debug_draw = (vp.debug_draw + 1) % 5
|
||||||
|
|
||||||
if event is InputEventKey and Input.is_key_pressed(KEY_F2):
|
|
||||||
take_screenshot()
|
|
||||||
|
|
||||||
if event is InputEventKey and Input.is_key_pressed(KEY_M):
|
if event is InputEventKey and Input.is_key_pressed(KEY_M):
|
||||||
toggle_menu()
|
toggle_menu()
|
||||||
|
|
||||||
|
@ -150,26 +144,3 @@ func vector_key_mapping(key_positive_x: int, key_negative_x: int, key_positive_y
|
||||||
vec = vec.normalized()
|
vec = vec.normalized()
|
||||||
|
|
||||||
return vec
|
return vec
|
||||||
|
|
||||||
func take_screenshot():
|
|
||||||
var vp = get_viewport()
|
|
||||||
var texture = vp.get_texture()
|
|
||||||
var image = texture.get_image()
|
|
||||||
|
|
||||||
var file_name = "%s.png" % Time.get_datetime_string_from_system().replace(":", "-")
|
|
||||||
|
|
||||||
if image == null:
|
|
||||||
return false
|
|
||||||
|
|
||||||
if OS.get_name() == "Android":
|
|
||||||
var path = OS.get_system_dir(OS.SYSTEM_DIR_PICTURES, false) + "/immersive-home/" + file_name
|
|
||||||
|
|
||||||
if not FileAccess.file_exists(path):
|
|
||||||
var dir = path.get_base_dir()
|
|
||||||
DirAccess.open("user://").make_dir_recursive(dir)
|
|
||||||
|
|
||||||
image.save_png(path)
|
|
||||||
else:
|
|
||||||
image.save_png("user://screenshots/%s.png" % Time.get_datetime_string_from_system().replace(":", "-"))
|
|
||||||
|
|
||||||
return true
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=12 format=3 uid="uid://eecv28y6jxk4"]
|
[gd_scene load_steps=13 format=3 uid="uid://eecv28y6jxk4"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://clc5dre31iskm" path="res://addons/godot-xr-tools/xr/start_xr.tscn" id="1_i4c04"]
|
[ext_resource type="PackedScene" uid="uid://clc5dre31iskm" path="res://addons/godot-xr-tools/xr/start_xr.tscn" id="1_i4c04"]
|
||||||
[ext_resource type="Script" path="res://content/main.gd" id="1_uvrd4"]
|
[ext_resource type="Script" path="res://content/main.gd" id="1_uvrd4"]
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://c3kdssrmv84kv" path="res://content/ui/menu/menu.tscn" id="8_du83w"]
|
[ext_resource type="PackedScene" uid="uid://c3kdssrmv84kv" path="res://content/ui/menu/menu.tscn" id="8_du83w"]
|
||||||
[ext_resource type="PackedScene" uid="uid://lrehk38exd5n" path="res://content/system/keyboard/keyboard.tscn" id="9_e5n3p"]
|
[ext_resource type="PackedScene" uid="uid://lrehk38exd5n" path="res://content/system/keyboard/keyboard.tscn" id="9_e5n3p"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cbemihbxkd4ll" path="res://content/system/house/house.tscn" id="9_np6mw"]
|
[ext_resource type="PackedScene" uid="uid://cbemihbxkd4ll" path="res://content/system/house/house.tscn" id="9_np6mw"]
|
||||||
|
[ext_resource type="Script" path="res://lib/utils/screenshot.gd" id="12_e13ym"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bhyddd1f0ry1x" path="res://content/ui/onboarding/onboarding.tscn" id="12_uq2nj"]
|
[ext_resource type="PackedScene" uid="uid://bhyddd1f0ry1x" path="res://content/ui/onboarding/onboarding.tscn" id="12_uq2nj"]
|
||||||
|
|
||||||
[node name="Main" type="Node3D"]
|
[node name="Main" type="Node3D"]
|
||||||
|
@ -33,17 +34,17 @@ enable_passthrough = true
|
||||||
[node name="XRControllerLeft" parent="XROrigin3D" instance=ExtResource("2_2lraw")]
|
[node name="XRControllerLeft" parent="XROrigin3D" instance=ExtResource("2_2lraw")]
|
||||||
transform = Transform3D(0.999999, -1.39633e-11, 0, 9.48075e-12, 1, 0, 0, 0, 1, -0.355145, 0.550439, -0.477945)
|
transform = Transform3D(0.999999, -1.39633e-11, 0, 9.48075e-12, 1, 0, 0, 0, 1, -0.355145, 0.550439, -0.477945)
|
||||||
|
|
||||||
[node name="IndexTip" parent="XROrigin3D/XRControllerLeft" index="6"]
|
[node name="IndexTip" parent="XROrigin3D/XRControllerLeft" index="4"]
|
||||||
transform = Transform3D(0.967526, 0.252326, -0.0150302, -0.0150302, 0.116784, 0.993043, 0.252326, -0.960569, 0.116784, -0.00665802, 0.0427913, -0.169868)
|
transform = Transform3D(0.967526, 0.252326, -0.0150302, -0.0150302, 0.116784, 0.993043, 0.252326, -0.960569, 0.116784, -0.00665808, 0.0427912, -0.169868)
|
||||||
|
|
||||||
[node name="ThumbTip" parent="XROrigin3D/XRControllerLeft" index="7"]
|
[node name="ThumbTip" parent="XROrigin3D/XRControllerLeft" index="5"]
|
||||||
transform = Transform3D(0.967042, 0.24582, -0.0663439, -0.0663439, 0.494837, 0.866449, 0.24582, -0.833492, 0.494837, 0.0261569, 0.0891964, -0.0934418)
|
transform = Transform3D(0.967043, 0.24582, -0.0663439, -0.0663439, 0.494837, 0.86645, 0.24582, -0.833492, 0.494837, 0.0261569, 0.0891963, -0.0934418)
|
||||||
|
|
||||||
[node name="MiddleTip" parent="XROrigin3D/XRControllerLeft" index="8"]
|
[node name="MiddleTip" parent="XROrigin3D/XRControllerLeft" index="6"]
|
||||||
transform = Transform3D(0.98042, 0.196912, 0.00149799, 0.001498, -0.015065, 0.999885, 0.196912, -0.980305, -0.0150651, -0.00327212, -0.00771424, -0.176318)
|
transform = Transform3D(0.98042, 0.196912, 0.00149799, 0.001498, -0.015065, 0.999885, 0.196912, -0.980305, -0.0150651, -0.00327212, -0.00771427, -0.176318)
|
||||||
|
|
||||||
[node name="Palm" parent="XROrigin3D/XRControllerLeft" index="9"]
|
[node name="Palm" parent="XROrigin3D/XRControllerLeft" index="7"]
|
||||||
transform = Transform3D(1, 3.12364e-06, -3.13861e-06, -3.12371e-06, 1, -1.97886e-05, 3.13854e-06, 1.97889e-05, 1, 0.0307807, -0.0419721, -0.0399505)
|
transform = Transform3D(1, 3.12361e-06, -3.13859e-06, -3.12371e-06, 1, -1.97886e-05, 3.13859e-06, 1.97889e-05, 1, 0.0307807, -0.0419722, -0.0399505)
|
||||||
|
|
||||||
[node name="XRControllerRight" parent="XROrigin3D" instance=ExtResource("7_0b3tc")]
|
[node name="XRControllerRight" parent="XROrigin3D" instance=ExtResource("7_0b3tc")]
|
||||||
transform = Transform3D(0.999999, -1.39635e-11, 0, 1.31553e-10, 1, 0, 0, 0, 1, 0.336726, 0.575093, -0.437942)
|
transform = Transform3D(0.999999, -1.39635e-11, 0, 1.31553e-10, 1, 0, 0, 0, 1, 0.336726, 0.575093, -0.437942)
|
||||||
|
@ -65,5 +66,8 @@ transform = Transform3D(0.5, 5.24309e-05, 0.000144384, -0.000139169, 0.353553, 0
|
||||||
[node name="Onboarding" parent="." instance=ExtResource("12_uq2nj")]
|
[node name="Onboarding" parent="." instance=ExtResource("12_uq2nj")]
|
||||||
transform = Transform3D(1, -1.39636e-11, 0, 4.42413e-11, 1, 0, 0, 0, 1, -0.576793, 0.820168, -0.60016)
|
transform = Transform3D(1, -1.39636e-11, 0, 4.42413e-11, 1, 0, 0, 0, 1, -0.576793, 0.820168, -0.60016)
|
||||||
|
|
||||||
|
[node name="Node" type="Node" parent="."]
|
||||||
|
script = ExtResource("12_e13ym")
|
||||||
|
|
||||||
[editable path="XROrigin3D/XRControllerLeft"]
|
[editable path="XROrigin3D/XRControllerLeft"]
|
||||||
[editable path="XROrigin3D/XRControllerLeft/hand_l"]
|
[editable path="XROrigin3D/XRControllerLeft/hand_l"]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
extends XRController3D
|
extends XRController3D
|
||||||
|
|
||||||
const Entity = preload ("res://content/entities/entity.gd")
|
|
||||||
const Pointer = preload ("res://lib/utils/pointer/pointer.gd")
|
const Pointer = preload ("res://lib/utils/pointer/pointer.gd")
|
||||||
const Initiator = preload ("res://lib/utils/pointer/initiator.gd")
|
const Initiator = preload ("res://lib/utils/pointer/initiator.gd")
|
||||||
const Finger = preload ("res://lib/utils/touch/finger.gd")
|
const Finger = preload ("res://lib/utils/touch/finger.gd")
|
||||||
|
@ -23,9 +22,6 @@ const Miniature = preload ("res://content/system/house/mini/miniature.gd")
|
||||||
|
|
||||||
@onready var palm = $Palm
|
@onready var palm = $Palm
|
||||||
@onready var ray: RayCast3D = $Raycast
|
@onready var ray: RayCast3D = $Raycast
|
||||||
@onready var area = $trash_bin/Area3D
|
|
||||||
@onready var trash_bin = $trash_bin
|
|
||||||
@onready var animation = $AnimationPlayer
|
|
||||||
@onready var quick_actions = $Palm/QuickActions
|
@onready var quick_actions = $Palm/QuickActions
|
||||||
|
|
||||||
var hand_active = false
|
var hand_active = false
|
||||||
|
@ -38,72 +34,10 @@ var grip_distance = 0.02
|
||||||
var pressed = false
|
var pressed = false
|
||||||
var grabbed = false
|
var grabbed = false
|
||||||
|
|
||||||
var to_delete = []
|
|
||||||
var trash_bin_visible: bool = true:
|
|
||||||
set(value):
|
|
||||||
if trash_bin_visible == value:
|
|
||||||
return
|
|
||||||
|
|
||||||
if value:
|
|
||||||
add_child(trash_bin)
|
|
||||||
else:
|
|
||||||
if animation.is_playing():
|
|
||||||
await animation.animation_finished
|
|
||||||
remove_child(trash_bin)
|
|
||||||
|
|
||||||
trash_bin_visible = value
|
|
||||||
|
|
||||||
var trash_bin_large: bool = false:
|
|
||||||
set(value):
|
|
||||||
if trash_bin_large == value:
|
|
||||||
return
|
|
||||||
|
|
||||||
if value:
|
|
||||||
animation.play("add_trashbin")
|
|
||||||
else:
|
|
||||||
animation.play_backwards("add_trashbin")
|
|
||||||
|
|
||||||
trash_bin_large = value
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
trash_bin_visible = false
|
|
||||||
|
|
||||||
_setup_hand()
|
_setup_hand()
|
||||||
|
|
||||||
EventSystem.on_grab_down.connect(func(event: EventPointer):
|
|
||||||
trash_bin_visible=_get_entity(event.target) != null
|
|
||||||
)
|
|
||||||
|
|
||||||
EventSystem.on_grab_move.connect(func(event):
|
|
||||||
if !trash_bin_visible:
|
|
||||||
return
|
|
||||||
|
|
||||||
var entity=_get_entity(event.target)
|
|
||||||
|
|
||||||
if entity is Entity&&area.overlaps_body(entity):
|
|
||||||
if !to_delete.has(entity):
|
|
||||||
to_delete.append(entity)
|
|
||||||
trash_bin_large=true
|
|
||||||
|
|
||||||
else:
|
|
||||||
to_delete.erase(entity)
|
|
||||||
trash_bin_large=false
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
EventSystem.on_grab_up.connect(func(_event: EventPointer):
|
|
||||||
if !trash_bin_visible:
|
|
||||||
return
|
|
||||||
|
|
||||||
for entity in to_delete:
|
|
||||||
entity.queue_free()
|
|
||||||
to_delete.clear()
|
|
||||||
trash_bin_large=false
|
|
||||||
trash_bin_visible=false
|
|
||||||
|
|
||||||
House.body.save_all_entities()
|
|
||||||
)
|
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
if !hand_active:
|
if !hand_active:
|
||||||
if quick_actions.is_inside_tree(): palm.remove_child(quick_actions)
|
if quick_actions.is_inside_tree(): palm.remove_child(quick_actions)
|
||||||
|
@ -124,28 +58,19 @@ func _physics_process(_delta):
|
||||||
var grab_close = distance_grab <= grip_distance
|
var grab_close = distance_grab <= grip_distance
|
||||||
|
|
||||||
if trigger_close&&!pressed:
|
if trigger_close&&!pressed:
|
||||||
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
pointer.pressed(Initiator.EventType.TRIGGER)
|
||||||
pressed = true
|
pressed = true
|
||||||
elif !trigger_close&&pressed:
|
elif !trigger_close&&pressed:
|
||||||
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
pointer.released(Initiator.EventType.TRIGGER)
|
||||||
pressed = false
|
pressed = false
|
||||||
|
|
||||||
if grab_close&&!grabbed:
|
if grab_close&&!grabbed:
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
pointer.pressed(Initiator.EventType.GRIP)
|
||||||
grabbed = true
|
grabbed = true
|
||||||
elif !grab_close&&grabbed:
|
elif !grab_close&&grabbed:
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
pointer.released(Initiator.EventType.GRIP)
|
||||||
grabbed = false
|
grabbed = false
|
||||||
|
|
||||||
func _get_entity(node: Node):
|
|
||||||
if node is Entity:
|
|
||||||
return node
|
|
||||||
|
|
||||||
if node.get_parent() == null:
|
|
||||||
return null
|
|
||||||
|
|
||||||
return _get_entity(node.get_parent())
|
|
||||||
|
|
||||||
func _setup_hand():
|
func _setup_hand():
|
||||||
TouchManager.add_finger(Finger.Type.INDEX_LEFT, $IndexTip/TouchArea)
|
TouchManager.add_finger(Finger.Type.INDEX_LEFT, $IndexTip/TouchArea)
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
[gd_scene load_steps=16 format=3 uid="uid://b30w6tywfj4fp"]
|
[gd_scene load_steps=12 format=3 uid="uid://b30w6tywfj4fp"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/system/controller_left/controller_left.gd" id="1_2j3qs"]
|
[ext_resource type="Script" path="res://content/system/controller_left/controller_left.gd" id="1_2j3qs"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dqjcqdhe3rbtn" path="res://assets/models/trash_bin/trash_bin.gltf" id="3_m33ce"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dscp8x0ari57n" path="res://content/system/raycast/raycast.tscn" id="4_n7lao"]
|
[ext_resource type="PackedScene" uid="uid://dscp8x0ari57n" path="res://content/system/raycast/raycast.tscn" id="4_n7lao"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bufelcry36rw1" path="res://addons/xr-autohandtracker/auto_handtracker.tscn" id="4_oe7fv"]
|
[ext_resource type="PackedScene" uid="uid://bufelcry36rw1" path="res://addons/xr-autohandtracker/auto_handtracker.tscn" id="4_oe7fv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dhaqth6q5yw4n" path="res://addons/godot-xr-tools/hands/model/hand_l.gltf" id="5_w1pvs"]
|
[ext_resource type="PackedScene" uid="uid://dhaqth6q5yw4n" path="res://addons/godot-xr-tools/hands/model/hand_l.gltf" id="5_w1pvs"]
|
||||||
[ext_resource type="Shader" path="res://assets/materials/hands.gdshader" id="6_wk733"]
|
[ext_resource type="Shader" path="res://assets/materials/hands.gdshader" id="6_wk733"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="6_x5vuc"]
|
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="6_x5vuc"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cfsnkoxb7mtok" path="res://content/system/trash_bin/trash_bin.tscn" id="7_vigb6"]
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_m58yb"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_m58yb"]
|
||||||
ao_enabled = true
|
ao_enabled = true
|
||||||
|
@ -15,89 +15,6 @@ ao_enabled = true
|
||||||
material = SubResource("StandardMaterial3D_m58yb")
|
material = SubResource("StandardMaterial3D_m58yb")
|
||||||
size = Vector3(0.01, 0.01, 0.01)
|
size = Vector3(0.01, 0.01, 0.01)
|
||||||
|
|
||||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_x2eyr"]
|
|
||||||
height = 0.105954
|
|
||||||
radius = 0.0447927
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_7owc4"]
|
|
||||||
length = 0.001
|
|
||||||
tracks/0/type = "bezier"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("trash_bin:scale:x")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0),
|
|
||||||
"points": PackedFloat32Array(0.03, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0)
|
|
||||||
}
|
|
||||||
tracks/1/type = "bezier"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath("trash_bin:scale:y")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0),
|
|
||||||
"points": PackedFloat32Array(0.03, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0)
|
|
||||||
}
|
|
||||||
tracks/2/type = "bezier"
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/path = NodePath("trash_bin:scale:z")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0),
|
|
||||||
"points": PackedFloat32Array(0.03, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_hax52"]
|
|
||||||
resource_name = "add_trashbin"
|
|
||||||
length = 0.3
|
|
||||||
tracks/0/type = "bezier"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("trash_bin:scale:x")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0, 0),
|
|
||||||
"points": PackedFloat32Array(0.03, -0.25, 0, 0.25, 0, 0.04, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0, 0.3)
|
|
||||||
}
|
|
||||||
tracks/1/type = "bezier"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath("trash_bin:scale:y")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0, 0),
|
|
||||||
"points": PackedFloat32Array(0.03, -0.25, 0, 0.25, 0, 0.04, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0, 0.3)
|
|
||||||
}
|
|
||||||
tracks/2/type = "bezier"
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/path = NodePath("trash_bin:scale:z")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0, 0),
|
|
||||||
"points": PackedFloat32Array(0.03, -0.25, 0, 0.25, 0, 0.04, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0, 0.3)
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hkli8"]
|
|
||||||
_data = {
|
|
||||||
"RESET": SubResource("Animation_7owc4"),
|
|
||||||
"add_trashbin": SubResource("Animation_hax52")
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ca85m"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ca85m"]
|
||||||
render_priority = 0
|
render_priority = 0
|
||||||
shader = ExtResource("6_wk733")
|
shader = ExtResource("6_wk733")
|
||||||
|
@ -117,22 +34,6 @@ script = ExtResource("1_2j3qs")
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
mesh = SubResource("BoxMesh_ir3co")
|
mesh = SubResource("BoxMesh_ir3co")
|
||||||
|
|
||||||
[node name="trash_bin" parent="." instance=ExtResource("3_m33ce")]
|
|
||||||
transform = Transform3D(0.03, 0, 0, 0, 0.03, 0, 0, 0, 0.03, 0.0864577, -0.119983, 0.0462675)
|
|
||||||
|
|
||||||
[node name="Area3D" type="Area3D" parent="trash_bin"]
|
|
||||||
transform = Transform3D(25, 0, 0, 0, 25, 0, 0, 0, 25, 0, 0, 0)
|
|
||||||
collision_layer = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="trash_bin/Area3D"]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0542412, 0)
|
|
||||||
shape = SubResource("CylinderShape3D_x2eyr")
|
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
|
||||||
libraries = {
|
|
||||||
"": SubResource("AnimationLibrary_hkli8")
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Raycast" parent="." instance=ExtResource("4_n7lao")]
|
[node name="Raycast" parent="." instance=ExtResource("4_n7lao")]
|
||||||
is_right = false
|
is_right = false
|
||||||
|
|
||||||
|
@ -163,7 +64,7 @@ collision_mask = 4
|
||||||
monitorable = false
|
monitorable = false
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="IndexTip/TouchArea"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="IndexTip/TouchArea"]
|
||||||
transform = Transform3D(1, -7.45058e-09, -2.22045e-16, 7.45058e-09, 1, 0, 0, 0, 1, 0, 0, 0)
|
transform = Transform3D(1, 0, 0, 1.49012e-08, 1, 0, 1.86265e-09, -7.45058e-09, 1, 0, -0.01, 0)
|
||||||
shape = SubResource("CapsuleShape3D_65k2y")
|
shape = SubResource("CapsuleShape3D_65k2y")
|
||||||
|
|
||||||
[node name="ThumbTip" type="BoneAttachment3D" parent="."]
|
[node name="ThumbTip" type="BoneAttachment3D" parent="."]
|
||||||
|
@ -210,4 +111,7 @@ transform = Transform3D(1, 1.73472e-18, 0, 0, 1, 0, 0, 0, 1, 0.0600001, -5.68873
|
||||||
label = "humidity_mid"
|
label = "humidity_mid"
|
||||||
icon = true
|
icon = true
|
||||||
|
|
||||||
|
[node name="TrashBin" parent="." instance=ExtResource("7_vigb6")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.109418, -0.126353, 0.0278937)
|
||||||
|
|
||||||
[editable path="hand_l"]
|
[editable path="hand_l"]
|
||||||
|
|
|
@ -58,15 +58,15 @@ func _physics_process(_delta):
|
||||||
var grab_close = distance_grab <= grip_distance
|
var grab_close = distance_grab <= grip_distance
|
||||||
|
|
||||||
if trigger_close&&!pressed:
|
if trigger_close&&!pressed:
|
||||||
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
pointer.pressed(Initiator.EventType.TRIGGER)
|
||||||
pressed = true
|
pressed = true
|
||||||
elif !trigger_close&&pressed:
|
elif !trigger_close&&pressed:
|
||||||
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
pointer.released(Initiator.EventType.TRIGGER)
|
||||||
pressed = false
|
pressed = false
|
||||||
|
|
||||||
if grab_close&&!grabbed:
|
if grab_close&&!grabbed:
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
pointer.pressed(Initiator.EventType.GRIP)
|
||||||
grabbed = true
|
grabbed = true
|
||||||
elif !grab_close&&grabbed:
|
elif !grab_close&&grabbed:
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
pointer.released(Initiator.EventType.GRIP)
|
||||||
grabbed = false
|
grabbed = false
|
|
@ -54,7 +54,7 @@ collision_mask = 4
|
||||||
monitorable = false
|
monitorable = false
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="IndexTip/TouchArea"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="IndexTip/TouchArea"]
|
||||||
transform = Transform3D(1, -7.45058e-09, -2.22045e-16, 7.45058e-09, 1, 0, 0, 0, 1, 0, 0, 0)
|
transform = Transform3D(1, 0, 0, -1.49012e-08, 1, 0, 0, -7.45058e-09, 1, 0, -0.01, 0)
|
||||||
shape = SubResource("CapsuleShape3D_66uu0")
|
shape = SubResource("CapsuleShape3D_66uu0")
|
||||||
|
|
||||||
[node name="ThumbTip" type="BoneAttachment3D" parent="."]
|
[node name="ThumbTip" type="BoneAttachment3D" parent="."]
|
||||||
|
|
|
@ -7,6 +7,7 @@ const TOUCH_LONG = 400.0
|
||||||
@export var entity: Entity
|
@export var entity: Entity
|
||||||
|
|
||||||
@onready var collision = $CollisionShape3D
|
@onready var collision = $CollisionShape3D
|
||||||
|
@onready var snap_sound = $SnapSound
|
||||||
@onready var label = $Label3D
|
@onready var label = $Label3D
|
||||||
var active = R.state(false)
|
var active = R.state(false)
|
||||||
var disabled = R.state(true)
|
var disabled = R.state(true)
|
||||||
|
@ -36,6 +37,7 @@ func _ready():
|
||||||
func _on_click(_event: EventPointer):
|
func _on_click(_event: EventPointer):
|
||||||
if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false:
|
if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false:
|
||||||
entity.quick_action()
|
entity.quick_action()
|
||||||
|
snap_sound.play()
|
||||||
else:
|
else:
|
||||||
miniature.entity_select.toggle(entity)
|
miniature.entity_select.toggle(entity)
|
||||||
|
|
||||||
|
@ -62,6 +64,7 @@ func _on_touch_leave(_event: EventTouch):
|
||||||
if touch_ran: return
|
if touch_ran: return
|
||||||
|
|
||||||
if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false:
|
if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false:
|
||||||
|
snap_sound.play()
|
||||||
entity.quick_action()
|
entity.quick_action()
|
||||||
else:
|
else:
|
||||||
miniature.entity_select.toggle(entity)
|
miniature.entity_select.toggle(entity)
|
|
@ -1,6 +1,7 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://b5buw1sas18n4"]
|
[gd_scene load_steps=6 format=3 uid="uid://b5buw1sas18n4"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/system/dot/dot.gd" id="1_vdpux"]
|
[ext_resource type="Script" path="res://content/system/dot/dot.gd" id="1_vdpux"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://du7ur0lu28cvn" path="res://assets/sound/finger-snap.mp3" id="3_04fcm"]
|
||||||
[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="4_504vw"]
|
[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="4_504vw"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_3wgjq"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_3wgjq"]
|
||||||
|
@ -34,3 +35,7 @@ monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="Area3D"]
|
[node name="CollisionShape3D2" type="CollisionShape3D" parent="Area3D"]
|
||||||
shape = SubResource("SphereShape3D_y1ne8")
|
shape = SubResource("SphereShape3D_y1ne8")
|
||||||
|
|
||||||
|
[node name="SnapSound" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("3_04fcm")
|
||||||
|
volume_db = -20.0
|
||||||
|
|
|
@ -1,150 +0,0 @@
|
||||||
extends Node3D
|
|
||||||
|
|
||||||
const Pointer = preload ("res://lib/utils/pointer/pointer.gd")
|
|
||||||
const Initiator = preload ("res://lib/utils/pointer/initiator.gd")
|
|
||||||
const Finger = preload ("res://lib/utils/touch/finger.gd")
|
|
||||||
const Touch = preload ("res://lib/utils/touch/touch.gd")
|
|
||||||
const Collide = preload ("res://lib/utils/touch/collide.gd")
|
|
||||||
const Miniature = preload ("res://content/system/house/mini/miniature.gd")
|
|
||||||
|
|
||||||
@onready var main = $"/root/Main"
|
|
||||||
@onready var palm = $XRHandLeft/Palm
|
|
||||||
@onready var quick_actions = $XRHandLeft/Palm/QuickActions
|
|
||||||
@onready var mini_view_button = $XRHandLeft/Palm/QuickActions/MiniView
|
|
||||||
@onready var temperature_button = $XRHandLeft/Palm/QuickActions/Temperature
|
|
||||||
@onready var humidity_button = $XRHandLeft/Palm/QuickActions/Humidity
|
|
||||||
@export var ray_left: RayCast3D
|
|
||||||
@export var ray_right: RayCast3D
|
|
||||||
@export var hand_left: Node3D
|
|
||||||
@export var hand_right: Node3D
|
|
||||||
|
|
||||||
@onready var bone_attachments_right = [$XRHandRight/IndexTip, $XRHandRight/ThumbTip, $XRHandRight/MiddleTip]
|
|
||||||
@onready var bone_attachments_left = [$XRHandLeft/IndexTip, $XRHandLeft/ThumbTip, $XRHandLeft/MiddleTip]
|
|
||||||
|
|
||||||
enum Fingers {INDEX, THUMB, MIDDLE}
|
|
||||||
|
|
||||||
var left_initiator: Initiator = Initiator.new()
|
|
||||||
var right_initiator: Initiator = Initiator.new()
|
|
||||||
var touch: Touch
|
|
||||||
var collide: Collide
|
|
||||||
var left_pointer: Pointer
|
|
||||||
var right_pointer: Pointer
|
|
||||||
var press_distance = 0.03
|
|
||||||
var grip_distance = 0.03
|
|
||||||
|
|
||||||
var pressed_left = false
|
|
||||||
var pressed_right = false
|
|
||||||
var grabbed_left = false
|
|
||||||
var grabbed_right = false
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
var fingers = {
|
|
||||||
Finger.Type.INDEX_RIGHT: $XRHandRight/IndexTip/TouchArea,
|
|
||||||
Finger.Type.INDEX_LEFT: $XRHandLeft/IndexTip/TouchArea,
|
|
||||||
Finger.Type.MIDDLE_RIGHT: $XRHandRight/MiddleTip/TouchArea,
|
|
||||||
Finger.Type.MIDDLE_LEFT: $XRHandLeft/MiddleTip/TouchArea
|
|
||||||
}
|
|
||||||
|
|
||||||
touch = Touch.new(fingers)
|
|
||||||
collide = Collide.new(hand_left, hand_right, $XRHandLeft/IndexTip/TouchArea, $XRHandRight/IndexTip/TouchArea)
|
|
||||||
add_child(touch)
|
|
||||||
add_child(collide)
|
|
||||||
|
|
||||||
_ready_hand()
|
|
||||||
|
|
||||||
mini_view_button.on_button_up.connect(func():
|
|
||||||
House.body.mini_view.small.value=!House.body.mini_view.small.value
|
|
||||||
)
|
|
||||||
|
|
||||||
temperature_button.on_button_up.connect(func():
|
|
||||||
if House.body.mini_view.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE:
|
|
||||||
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.NONE
|
|
||||||
else:
|
|
||||||
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.TEMPERATURE
|
|
||||||
)
|
|
||||||
|
|
||||||
humidity_button.on_button_up.connect(func():
|
|
||||||
if House.body.mini_view.heatmap_type.value == Miniature.HeatmapType.HUMIDITY:
|
|
||||||
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.NONE
|
|
||||||
else:
|
|
||||||
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.HUMIDITY
|
|
||||||
)
|
|
||||||
|
|
||||||
func _ready_hand():
|
|
||||||
left_initiator.type = Initiator.Type.HAND_LEFT
|
|
||||||
left_initiator.node = ray_left.get_parent()
|
|
||||||
|
|
||||||
left_pointer = Pointer.new(left_initiator, ray_left)
|
|
||||||
add_child(left_pointer)
|
|
||||||
|
|
||||||
right_initiator.type = Initiator.Type.HAND_RIGHT
|
|
||||||
right_initiator.node = ray_right.get_parent()
|
|
||||||
|
|
||||||
right_pointer = Pointer.new(right_initiator, ray_right)
|
|
||||||
add_child(right_pointer)
|
|
||||||
|
|
||||||
func _process(_delta):
|
|
||||||
if main.camera.global_transform.basis.z.dot(palm.global_transform.basis.y) > 0.85:
|
|
||||||
if quick_actions.is_inside_tree() == false: palm.add_child(quick_actions)
|
|
||||||
else:
|
|
||||||
if quick_actions.is_inside_tree(): palm.remove_child(quick_actions)
|
|
||||||
|
|
||||||
func _physics_process(_delta):
|
|
||||||
_process_hand_left(hand_left)
|
|
||||||
_process_hand_right(hand_right)
|
|
||||||
|
|
||||||
func _process_hand_left(hand: Node3D):
|
|
||||||
var index_tip = bone_attachments_left[Fingers.INDEX].get_node("Marker3D")
|
|
||||||
var thumb_tip = bone_attachments_left[Fingers.THUMB].get_node("Marker3D")
|
|
||||||
var middle_tip = bone_attachments_left[Fingers.MIDDLE].get_node("Marker3D")
|
|
||||||
|
|
||||||
var _ray = ray_left if hand == hand_left else ray_right
|
|
||||||
var initiator = left_initiator if hand == hand_left else right_initiator
|
|
||||||
|
|
||||||
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
|
|
||||||
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
|
|
||||||
|
|
||||||
var trigger_close = distance_trigger <= press_distance
|
|
||||||
var grab_close = distance_grab <= grip_distance
|
|
||||||
|
|
||||||
if trigger_close&&!pressed_left:
|
|
||||||
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
|
||||||
pressed_left = true
|
|
||||||
elif !trigger_close&&pressed_left:
|
|
||||||
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
|
||||||
pressed_left = false
|
|
||||||
|
|
||||||
if grab_close&&!grabbed_left:
|
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_left = true
|
|
||||||
elif !grab_close&&grabbed_left:
|
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_left = false
|
|
||||||
|
|
||||||
func _process_hand_right(hand: Node3D):
|
|
||||||
var index_tip = bone_attachments_right[Fingers.INDEX].get_node("Marker3D")
|
|
||||||
var thumb_tip = bone_attachments_right[Fingers.THUMB].get_node("Marker3D")
|
|
||||||
var middle_tip = bone_attachments_right[Fingers.MIDDLE].get_node("Marker3D")
|
|
||||||
|
|
||||||
var _ray = ray_left if hand == hand_left else ray_right
|
|
||||||
var initiator = left_initiator if hand == hand_left else right_initiator
|
|
||||||
|
|
||||||
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
|
|
||||||
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
|
|
||||||
|
|
||||||
var trigger_close = distance_trigger <= press_distance
|
|
||||||
var grab_close = distance_grab <= grip_distance
|
|
||||||
|
|
||||||
if trigger_close&&!pressed_right:
|
|
||||||
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
|
||||||
pressed_right = true
|
|
||||||
elif !trigger_close&&pressed_right:
|
|
||||||
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
|
||||||
pressed_right = false
|
|
||||||
|
|
||||||
if grab_close&&!grabbed_right:
|
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_right = true
|
|
||||||
elif !grab_close&&grabbed_right:
|
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_right = false
|
|
|
@ -1,14 +1,166 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://bsx12q23v8apy"]
|
[gd_scene load_steps=4 format=3 uid="uid://byj36o0boo1v2"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/system/hands/hands.gd" id="1_c4f76"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_te2p8"]
|
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_te2p8"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_4kea7"]
|
||||||
|
script/source = "extends Node3D
|
||||||
|
|
||||||
|
const Pointer = preload (\"res://lib/utils/pointer/pointer.gd\")
|
||||||
|
const Initiator = preload (\"res://lib/utils/pointer/initiator.gd\")
|
||||||
|
const Finger = preload (\"res://lib/utils/touch/finger.gd\")
|
||||||
|
const Touch = preload (\"res://lib/utils/touch/touch.gd\")
|
||||||
|
const Collide = preload (\"res://lib/utils/touch/collide.gd\")
|
||||||
|
const Miniature = preload (\"res://content/system/house/mini/miniature.gd\")
|
||||||
|
|
||||||
|
@onready var main = $\"/root/Main\"
|
||||||
|
@onready var palm = $XRHandLeft/Palm
|
||||||
|
@onready var quick_actions = $XRHandLeft/Palm/QuickActions
|
||||||
|
@onready var mini_view_button = $XRHandLeft/Palm/QuickActions/MiniView
|
||||||
|
@onready var temperature_button = $XRHandLeft/Palm/QuickActions/Temperature
|
||||||
|
@onready var humidity_button = $XRHandLeft/Palm/QuickActions/Humidity
|
||||||
|
@export var ray_left: RayCast3D
|
||||||
|
@export var ray_right: RayCast3D
|
||||||
|
@export var hand_left: Node3D
|
||||||
|
@export var hand_right: Node3D
|
||||||
|
|
||||||
|
@onready var bone_attachments_right = [$XRHandRight/IndexTip, $XRHandRight/ThumbTip, $XRHandRight/MiddleTip]
|
||||||
|
@onready var bone_attachments_left = [$XRHandLeft/IndexTip, $XRHandLeft/ThumbTip, $XRHandLeft/MiddleTip]
|
||||||
|
|
||||||
|
enum Fingers {INDEX, THUMB, MIDDLE}
|
||||||
|
|
||||||
|
var left_initiator: Initiator = Initiator.new()
|
||||||
|
var right_initiator: Initiator = Initiator.new()
|
||||||
|
var touch: Touch
|
||||||
|
var collide: Collide
|
||||||
|
var left_pointer: Pointer
|
||||||
|
var right_pointer: Pointer
|
||||||
|
var press_distance = 0.03
|
||||||
|
var grip_distance = 0.03
|
||||||
|
|
||||||
|
var pressed_left = false
|
||||||
|
var pressed_right = false
|
||||||
|
var grabbed_left = false
|
||||||
|
var grabbed_right = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
var fingers = {
|
||||||
|
Finger.Type.INDEX_RIGHT: $XRHandRight/IndexTip/TouchArea,
|
||||||
|
Finger.Type.INDEX_LEFT: $XRHandLeft/IndexTip/TouchArea,
|
||||||
|
Finger.Type.MIDDLE_RIGHT: $XRHandRight/MiddleTip/TouchArea,
|
||||||
|
Finger.Type.MIDDLE_LEFT: $XRHandLeft/MiddleTip/TouchArea
|
||||||
|
}
|
||||||
|
|
||||||
|
touch = Touch.new(fingers)
|
||||||
|
collide = Collide.new(hand_left, hand_right, $XRHandLeft/IndexTip/TouchArea, $XRHandRight/IndexTip/TouchArea)
|
||||||
|
add_child(touch)
|
||||||
|
add_child(collide)
|
||||||
|
|
||||||
|
_ready_hand()
|
||||||
|
|
||||||
|
mini_view_button.on_button_up.connect(func():
|
||||||
|
House.body.mini_view.small.value=!House.body.mini_view.small.value
|
||||||
|
)
|
||||||
|
|
||||||
|
temperature_button.on_button_up.connect(func():
|
||||||
|
if House.body.mini_view.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE:
|
||||||
|
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.NONE
|
||||||
|
else:
|
||||||
|
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.TEMPERATURE
|
||||||
|
)
|
||||||
|
|
||||||
|
humidity_button.on_button_up.connect(func():
|
||||||
|
if House.body.mini_view.heatmap_type.value == Miniature.HeatmapType.HUMIDITY:
|
||||||
|
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.NONE
|
||||||
|
else:
|
||||||
|
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.HUMIDITY
|
||||||
|
)
|
||||||
|
|
||||||
|
func _ready_hand():
|
||||||
|
left_initiator.type = Initiator.Type.HAND_LEFT
|
||||||
|
left_initiator.node = ray_left.get_parent()
|
||||||
|
|
||||||
|
left_pointer = Pointer.new(left_initiator, ray_left)
|
||||||
|
add_child(left_pointer)
|
||||||
|
|
||||||
|
right_initiator.type = Initiator.Type.HAND_RIGHT
|
||||||
|
right_initiator.node = ray_right.get_parent()
|
||||||
|
|
||||||
|
right_pointer = Pointer.new(right_initiator, ray_right)
|
||||||
|
add_child(right_pointer)
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
if main.camera.global_transform.basis.z.dot(palm.global_transform.basis.y) > 0.85:
|
||||||
|
if quick_actions.is_inside_tree() == false: palm.add_child(quick_actions)
|
||||||
|
else:
|
||||||
|
if quick_actions.is_inside_tree(): palm.remove_child(quick_actions)
|
||||||
|
|
||||||
|
func _physics_process(_delta):
|
||||||
|
_process_hand_left(hand_left)
|
||||||
|
_process_hand_right(hand_right)
|
||||||
|
|
||||||
|
func _process_hand_left(hand: Node3D):
|
||||||
|
var index_tip = bone_attachments_left[Fingers.INDEX].get_node(\"Marker3D\")
|
||||||
|
var thumb_tip = bone_attachments_left[Fingers.THUMB].get_node(\"Marker3D\")
|
||||||
|
var middle_tip = bone_attachments_left[Fingers.MIDDLE].get_node(\"Marker3D\")
|
||||||
|
|
||||||
|
var _ray = ray_left if hand == hand_left else ray_right
|
||||||
|
var initiator = left_initiator if hand == hand_left else right_initiator
|
||||||
|
|
||||||
|
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
|
||||||
|
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
|
||||||
|
|
||||||
|
var trigger_close = distance_trigger <= press_distance
|
||||||
|
var grab_close = distance_grab <= grip_distance
|
||||||
|
|
||||||
|
if trigger_close&&!pressed_left:
|
||||||
|
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
||||||
|
pressed_left = true
|
||||||
|
elif !trigger_close&&pressed_left:
|
||||||
|
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
||||||
|
pressed_left = false
|
||||||
|
|
||||||
|
if grab_close&&!grabbed_left:
|
||||||
|
initiator.on_press.emit(Initiator.EventType.GRIP)
|
||||||
|
grabbed_left = true
|
||||||
|
elif !grab_close&&grabbed_left:
|
||||||
|
initiator.on_release.emit(Initiator.EventType.GRIP)
|
||||||
|
grabbed_left = false
|
||||||
|
|
||||||
|
func _process_hand_right(hand: Node3D):
|
||||||
|
var index_tip = bone_attachments_right[Fingers.INDEX].get_node(\"Marker3D\")
|
||||||
|
var thumb_tip = bone_attachments_right[Fingers.THUMB].get_node(\"Marker3D\")
|
||||||
|
var middle_tip = bone_attachments_right[Fingers.MIDDLE].get_node(\"Marker3D\")
|
||||||
|
|
||||||
|
var _ray = ray_left if hand == hand_left else ray_right
|
||||||
|
var initiator = left_initiator if hand == hand_left else right_initiator
|
||||||
|
|
||||||
|
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
|
||||||
|
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
|
||||||
|
|
||||||
|
var trigger_close = distance_trigger <= press_distance
|
||||||
|
var grab_close = distance_grab <= grip_distance
|
||||||
|
|
||||||
|
if trigger_close&&!pressed_right:
|
||||||
|
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
||||||
|
pressed_right = true
|
||||||
|
elif !trigger_close&&pressed_right:
|
||||||
|
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
||||||
|
pressed_right = false
|
||||||
|
|
||||||
|
if grab_close&&!grabbed_right:
|
||||||
|
initiator.on_press.emit(Initiator.EventType.GRIP)
|
||||||
|
grabbed_right = true
|
||||||
|
elif !grab_close&&grabbed_right:
|
||||||
|
initiator.on_release.emit(Initiator.EventType.GRIP)
|
||||||
|
grabbed_right = false
|
||||||
|
"
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dopke"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dopke"]
|
||||||
radius = 0.001
|
radius = 0.001
|
||||||
height = 0.02
|
height = 0.02
|
||||||
|
|
||||||
[node name="Hands" type="Node3D"]
|
[node name="Hands" type="Node3D"]
|
||||||
script = ExtResource("1_c4f76")
|
script = SubResource("GDScript_4kea7")
|
||||||
|
|
||||||
[node name="XRHandLeft" type="Node3D" parent="."]
|
[node name="XRHandLeft" type="Node3D" parent="."]
|
||||||
transform = Transform3D(0.999999, -1.39628e-11, 0, 9.48119e-12, 0.999999, -4.54747e-13, 0, 0, 0.999999, -0.25, 0, 0)
|
transform = Transform3D(0.999999, -1.39628e-11, 0, 9.48119e-12, 0.999999, -4.54747e-13, 0, 0, 0.999999, -0.25, 0, 0)
|
||||||
|
|
|
@ -28,11 +28,11 @@ func _ready():
|
||||||
|
|
||||||
get_parent().button_pressed.connect(func(button: String):
|
get_parent().button_pressed.connect(func(button: String):
|
||||||
if _event_type_map.has(button):
|
if _event_type_map.has(button):
|
||||||
initiator.on_press.emit(_event_type_map[button])
|
pointer.pressed(_event_type_map[button])
|
||||||
)
|
)
|
||||||
get_parent().button_released.connect(func(button: String):
|
get_parent().button_released.connect(func(button: String):
|
||||||
if _event_type_map.has(button):
|
if _event_type_map.has(button):
|
||||||
initiator.on_release.emit(_event_type_map[button])
|
pointer.released(_event_type_map[button])
|
||||||
)
|
)
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
|
|
85
app/content/system/trash_bin/trash_bin.gd
Normal file
85
app/content/system/trash_bin/trash_bin.gd
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
extends Node3D
|
||||||
|
|
||||||
|
const Entity = preload ("res://content/entities/entity.gd")
|
||||||
|
|
||||||
|
@onready var trash_bin = $trash_bin
|
||||||
|
@onready var bin_area = $trash_bin/Area3D
|
||||||
|
|
||||||
|
@onready var delete_sound = $DeleteSound
|
||||||
|
@onready var animation = $AnimationPlayer
|
||||||
|
|
||||||
|
var to_delete = []
|
||||||
|
var trash_bin_visible: bool = true:
|
||||||
|
set(value):
|
||||||
|
if trash_bin_visible == value:
|
||||||
|
return
|
||||||
|
|
||||||
|
if value:
|
||||||
|
add_child(trash_bin)
|
||||||
|
else:
|
||||||
|
if animation.is_playing():
|
||||||
|
await animation.animation_finished
|
||||||
|
remove_child(trash_bin)
|
||||||
|
|
||||||
|
trash_bin_visible = value
|
||||||
|
|
||||||
|
var trash_bin_large: bool = false:
|
||||||
|
set(value):
|
||||||
|
if trash_bin_large == value:
|
||||||
|
return
|
||||||
|
|
||||||
|
if value:
|
||||||
|
animation.play("add_trashbin")
|
||||||
|
else:
|
||||||
|
animation.play_backwards("add_trashbin")
|
||||||
|
|
||||||
|
trash_bin_large = value
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
trash_bin_visible = false
|
||||||
|
|
||||||
|
EventSystem.on_grab_down.connect(func(event: EventPointer):
|
||||||
|
trash_bin_visible=_get_entity(event.target) != null
|
||||||
|
)
|
||||||
|
|
||||||
|
EventSystem.on_grab_move.connect(func(event):
|
||||||
|
if !trash_bin_visible:
|
||||||
|
return
|
||||||
|
|
||||||
|
var entity=_get_entity(event.target)
|
||||||
|
|
||||||
|
if entity is Entity&&bin_area.overlaps_body(entity):
|
||||||
|
if !to_delete.has(entity):
|
||||||
|
to_delete.append(entity)
|
||||||
|
trash_bin_large=true
|
||||||
|
|
||||||
|
else:
|
||||||
|
to_delete.erase(entity)
|
||||||
|
trash_bin_large=false
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
EventSystem.on_grab_up.connect(func(_event: EventPointer):
|
||||||
|
if !trash_bin_visible:
|
||||||
|
return
|
||||||
|
|
||||||
|
if to_delete.size() > 0:
|
||||||
|
delete_sound.play()
|
||||||
|
|
||||||
|
for entity in to_delete:
|
||||||
|
entity.queue_free()
|
||||||
|
to_delete.clear()
|
||||||
|
trash_bin_large=false
|
||||||
|
trash_bin_visible=false
|
||||||
|
|
||||||
|
House.body.save_all_entities()
|
||||||
|
)
|
||||||
|
|
||||||
|
func _get_entity(node: Node):
|
||||||
|
if node is Entity:
|
||||||
|
return node
|
||||||
|
|
||||||
|
if node.get_parent() == null:
|
||||||
|
return null
|
||||||
|
|
||||||
|
return _get_entity(node.get_parent())
|
93
app/content/system/trash_bin/trash_bin.tscn
Normal file
93
app/content/system/trash_bin/trash_bin.tscn
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
[gd_scene load_steps=8 format=3 uid="uid://cfsnkoxb7mtok"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dqjcqdhe3rbtn" path="res://assets/models/trash_bin/trash_bin.gltf" id="1_g2oxl"]
|
||||||
|
[ext_resource type="Script" path="res://content/system/trash_bin/trash_bin.gd" id="1_krk5w"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bm2uxwqfmnvs6" path="res://assets/sound/crumple.mp3" id="3_p7u0v"]
|
||||||
|
|
||||||
|
[sub_resource type="CylinderShape3D" id="CylinderShape3D_fmaps"]
|
||||||
|
height = 0.105954
|
||||||
|
radius = 0.0447927
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_wg64y"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("trash_bin:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0.03, 0.03, 0.03)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("trash_bin:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, -0.02, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_cxelh"]
|
||||||
|
resource_name = "add_trashbin"
|
||||||
|
length = 0.4
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("trash_bin:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0.03, 0.03, 0.03), Vector3(0.04, 0.04, 0.04)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("trash_bin:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 0), Vector3(0, -0.02, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hrejr"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_wg64y"),
|
||||||
|
"add_trashbin": SubResource("Animation_cxelh")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="TrashBin" type="Node3D"]
|
||||||
|
script = ExtResource("1_krk5w")
|
||||||
|
|
||||||
|
[node name="trash_bin" parent="." instance=ExtResource("1_g2oxl")]
|
||||||
|
transform = Transform3D(0.03, 0, 0, 0, 0.03, 0, 0, 0, 0.03, 0, -0.02, 0)
|
||||||
|
|
||||||
|
[node name="Area3D" type="Area3D" parent="trash_bin"]
|
||||||
|
transform = Transform3D(25, 0, 0, 0, 25, 0, 0, 0, 25, 0, 0, 0)
|
||||||
|
collision_layer = 0
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="trash_bin/Area3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0542412, 0)
|
||||||
|
shape = SubResource("CylinderShape3D_fmaps")
|
||||||
|
|
||||||
|
[node name="DeleteSound" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource("3_p7u0v")
|
||||||
|
volume_db = -10.0
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_hrejr")
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ const ECHO_WAIT_REPEAT = 0.1
|
||||||
@onready var finger_area_collision: CollisionShape3D = $FingerArea/CollisionShape3D
|
@onready var finger_area_collision: CollisionShape3D = $FingerArea/CollisionShape3D
|
||||||
@onready var touch_collision: CollisionShape3D = $TouchBody/CollisionShape3D
|
@onready var touch_collision: CollisionShape3D = $TouchBody/CollisionShape3D
|
||||||
@onready var touch: StaticBody3D = $TouchBody
|
@onready var touch: StaticBody3D = $TouchBody
|
||||||
|
@onready var click_sound = $ClickSound
|
||||||
|
|
||||||
@export var focusable: bool = true:
|
@export var focusable: bool = true:
|
||||||
set(value):
|
set(value):
|
||||||
|
@ -115,7 +116,7 @@ func _on_press_down(event):
|
||||||
event.bubbling = false
|
event.bubbling = false
|
||||||
return
|
return
|
||||||
|
|
||||||
AudioPlayer.play_effect("click")
|
click_sound.play()
|
||||||
|
|
||||||
if toggleable:
|
if toggleable:
|
||||||
return
|
return
|
||||||
|
@ -163,7 +164,7 @@ func _on_touch_enter(event: EventTouch):
|
||||||
event.bubbling = false
|
event.bubbling = false
|
||||||
return
|
return
|
||||||
|
|
||||||
AudioPlayer.play_effect("click")
|
click_sound.play()
|
||||||
|
|
||||||
if toggleable:
|
if toggleable:
|
||||||
active = !active
|
active = !active
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://bsjqdvkt0u87c"]
|
[gd_scene load_steps=9 format=3 uid="uid://bsjqdvkt0u87c"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"]
|
[ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"]
|
||||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_db5by"]
|
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_db5by"]
|
||||||
[ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="3_skm86"]
|
[ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="3_skm86"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://c1yu80uj3fsn7" path="res://assets/sound/click.wav" id="4_51sb0"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_n8om1"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_826v7"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
render_priority = 10
|
render_priority = 10
|
||||||
shader = ExtResource("2_db5by")
|
shader = ExtResource("2_db5by")
|
||||||
|
@ -19,7 +20,7 @@ shader_parameter/corner_radius = 0.2
|
||||||
shader_parameter/roughness = 0.3
|
shader_parameter/roughness = 0.3
|
||||||
shader_parameter/grain_amount = 0.02
|
shader_parameter/grain_amount = 0.02
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_dxm1i"]
|
[sub_resource type="QuadMesh" id="QuadMesh_02501"]
|
||||||
size = Vector2(0.04, 0.04)
|
size = Vector2(0.04, 0.04)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"]
|
||||||
|
@ -42,8 +43,8 @@ collision_mask = 0
|
||||||
|
|
||||||
[node name="Panel3D" type="MeshInstance3D" parent="Body"]
|
[node name="Panel3D" type="MeshInstance3D" parent="Body"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||||
material_override = SubResource("ShaderMaterial_n8om1")
|
material_override = SubResource("ShaderMaterial_826v7")
|
||||||
mesh = SubResource("QuadMesh_dxm1i")
|
mesh = SubResource("QuadMesh_02501")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
script = ExtResource("3_skm86")
|
script = ExtResource("3_skm86")
|
||||||
size = Vector2(0.04, 0.04)
|
size = Vector2(0.04, 0.04)
|
||||||
|
@ -78,3 +79,7 @@ collision_mask = 0
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TouchBody"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="TouchBody"]
|
||||||
shape = SubResource("BoxShape3D_xwopm")
|
shape = SubResource("BoxShape3D_xwopm")
|
||||||
|
|
||||||
|
[node name="ClickSound" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("4_51sb0")
|
||||||
|
volume_db = -18.0
|
||||||
|
|
|
@ -13,6 +13,7 @@ signal on_text_changed(text: String)
|
||||||
@onready var animation: AnimationPlayer = $AnimationPlayer
|
@onready var animation: AnimationPlayer = $AnimationPlayer
|
||||||
@onready var label: Label3D = $Body/Label
|
@onready var label: Label3D = $Body/Label
|
||||||
@onready var placeholder_label: Label3D = $Body/Placeholder
|
@onready var placeholder_label: Label3D = $Body/Placeholder
|
||||||
|
@onready var snap_sound = $SnapSound
|
||||||
|
|
||||||
@export var placeholder: String = "":
|
@export var placeholder: String = "":
|
||||||
set(value):
|
set(value):
|
||||||
|
@ -135,6 +136,7 @@ func _on_focus_in(_event):
|
||||||
caret.visible = true
|
caret.visible = true
|
||||||
panel.active = true
|
panel.active = true
|
||||||
animation.play("blink")
|
animation.play("blink")
|
||||||
|
snap_sound.play()
|
||||||
_update_placeholder()
|
_update_placeholder()
|
||||||
|
|
||||||
func update_caret_position(event):
|
func update_caret_position(event):
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
[ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="3_ij5fh"]
|
[ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="3_ij5fh"]
|
||||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_nl02b"]
|
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_nl02b"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_a00dk"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_w3y4s"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
render_priority = 10
|
render_priority = 10
|
||||||
shader = ExtResource("3_nl02b")
|
shader = ExtResource("3_nl02b")
|
||||||
|
@ -20,7 +20,7 @@ shader_parameter/corner_radius = 0.2
|
||||||
shader_parameter/roughness = 0.3
|
shader_parameter/roughness = 0.3
|
||||||
shader_parameter/grain_amount = 0.02
|
shader_parameter/grain_amount = 0.02
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_har6y"]
|
[sub_resource type="QuadMesh" id="QuadMesh_rsne0"]
|
||||||
size = Vector2(0.15, 0.03)
|
size = Vector2(0.15, 0.03)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_x4yp8"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_x4yp8"]
|
||||||
|
@ -83,8 +83,8 @@ collision_mask = 6
|
||||||
|
|
||||||
[node name="Panel3D" type="MeshInstance3D" parent="Body"]
|
[node name="Panel3D" type="MeshInstance3D" parent="Body"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||||
material_override = SubResource("ShaderMaterial_a00dk")
|
material_override = SubResource("ShaderMaterial_w3y4s")
|
||||||
mesh = SubResource("QuadMesh_har6y")
|
mesh = SubResource("QuadMesh_rsne0")
|
||||||
script = ExtResource("3_3bvrj")
|
script = ExtResource("3_3bvrj")
|
||||||
size = Vector2(0.15, 0.03)
|
size = Vector2(0.15, 0.03)
|
||||||
|
|
||||||
|
@ -128,3 +128,5 @@ root_node = NodePath("../Body")
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_1sy4t")
|
"": SubResource("AnimationLibrary_1sy4t")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="SnapSound" type="AudioStreamPlayer" parent="."]
|
||||||
|
|
|
@ -4,6 +4,7 @@ const ButtonScene = preload ("res://content/ui/components/button/button.tscn")
|
||||||
|
|
||||||
@onready var devices_page = $Devices
|
@onready var devices_page = $Devices
|
||||||
@onready var entities_page = $Entities
|
@onready var entities_page = $Entities
|
||||||
|
@onready var spawn_sound = $SpawnSound
|
||||||
|
|
||||||
var selected_device = R.state(null)
|
var selected_device = R.state(null)
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ func _ready():
|
||||||
)
|
)
|
||||||
|
|
||||||
entities_page.on_select_entity.connect(func(entity_name):
|
entities_page.on_select_entity.connect(func(entity_name):
|
||||||
AudioPlayer.play_effect("spawn")
|
spawn_sound.play()
|
||||||
|
|
||||||
var entity=House.body.create_entity(entity_name, global_position)
|
var entity=House.body.create_entity(entity_name, global_position)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=13 format=3 uid="uid://crrb0l3ekuotj"]
|
[gd_scene load_steps=14 format=3 uid="uid://crrb0l3ekuotj"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/ui/menu/edit/edit_menu.gd" id="1_34cbn"]
|
[ext_resource type="Script" path="res://content/ui/menu/edit/edit_menu.gd" id="1_34cbn"]
|
||||||
[ext_resource type="Script" path="res://content/ui/menu/edit/devices.gd" id="2_rkvf4"]
|
[ext_resource type="Script" path="res://content/ui/menu/edit/devices.gd" id="2_rkvf4"]
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
[ext_resource type="Script" path="res://content/ui/menu/edit/entities.gd" id="5_t34xe"]
|
[ext_resource type="Script" path="res://content/ui/menu/edit/entities.gd" id="5_t34xe"]
|
||||||
[ext_resource type="Script" path="res://content/ui/components/flex_container/flex_container.gd" id="6_cr6p6"]
|
[ext_resource type="Script" path="res://content/ui/components/flex_container/flex_container.gd" id="6_cr6p6"]
|
||||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="6_evh58"]
|
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="6_evh58"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cn2qohl6abgeu" path="res://assets/sound/spawn.wav" id="11_7qxwt"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hstwo"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hstwo"]
|
||||||
render_priority = -3
|
render_priority = -3
|
||||||
|
@ -131,3 +132,7 @@ visible = false
|
||||||
material_override = SubResource("ShaderMaterial_hstwo")
|
material_override = SubResource("ShaderMaterial_hstwo")
|
||||||
mesh = SubResource("QuadMesh_4pj6f")
|
mesh = SubResource("QuadMesh_4pj6f")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="SpawnSound" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource("11_7qxwt")
|
||||||
|
volume_db = -10.0
|
||||||
|
|
|
@ -3,6 +3,8 @@ extends Node3D
|
||||||
const Notification = preload ("res://content/ui/components/notification/notification.tscn")
|
const Notification = preload ("res://content/ui/components/notification/notification.tscn")
|
||||||
|
|
||||||
@onready var animation_player = $AnimationPlayer
|
@onready var animation_player = $AnimationPlayer
|
||||||
|
@onready var open_sound = $OpenSound
|
||||||
|
@onready var close_sound = $CloseSound
|
||||||
@onready var notify_place = $AnimationContainer/NotifyPlace
|
@onready var notify_place = $AnimationContainer/NotifyPlace
|
||||||
@onready var main = $"/root/Main"
|
@onready var main = $"/root/Main"
|
||||||
|
|
||||||
|
@ -18,10 +20,12 @@ func _ready():
|
||||||
main.add_child(self)
|
main.add_child(self)
|
||||||
move_into_view()
|
move_into_view()
|
||||||
animation_player.play_backwards("hide_menu")
|
animation_player.play_backwards("hide_menu")
|
||||||
AudioPlayer.play_effect("open_menu")
|
open_sound.play()
|
||||||
|
close_sound.stop()
|
||||||
else:
|
else:
|
||||||
animation_player.play("hide_menu")
|
animation_player.play("hide_menu")
|
||||||
AudioPlayer.play_effect("close_menu")
|
close_sound.play()
|
||||||
|
open_sound.stop()
|
||||||
)
|
)
|
||||||
|
|
||||||
animation_player.animation_finished.connect(func(_animation):
|
animation_player.animation_finished.connect(func(_animation):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=21 format=3 uid="uid://c3kdssrmv84kv"]
|
[gd_scene load_steps=23 format=3 uid="uid://c3kdssrmv84kv"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"]
|
[ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"]
|
||||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_8coxu"]
|
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_8coxu"]
|
||||||
|
@ -11,9 +11,11 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://ddpxthb414unp" path="res://content/ui/menu/view/view_menu.tscn" id="8_71pkg"]
|
[ext_resource type="PackedScene" uid="uid://ddpxthb414unp" path="res://content/ui/menu/view/view_menu.tscn" id="8_71pkg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c01gkeldvjwtr" path="res://content/ui/menu/room/room_menu.tscn" id="10_u4i1x"]
|
[ext_resource type="PackedScene" uid="uid://c01gkeldvjwtr" path="res://content/ui/menu/room/room_menu.tscn" id="10_u4i1x"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c6r4higceibif" path="res://content/ui/menu/settings/settings_menu.tscn" id="11_7wm6b"]
|
[ext_resource type="PackedScene" uid="uid://c6r4higceibif" path="res://content/ui/menu/settings/settings_menu.tscn" id="11_7wm6b"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://nmm8y0xt5wyj" path="res://assets/sound/open_menu.wav" id="12_dsnuc"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bnx2uv4nmra8f" path="res://assets/sound/close_menu.wav" id="13_nnnln"]
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_e1esh"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_e1esh"]
|
||||||
size = Vector3(0.51, 0.32, 0.013)
|
size = Vector3(0.51, 0.32, 0.034332)
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_du6qr"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_du6qr"]
|
||||||
render_priority = 0
|
render_priority = 0
|
||||||
|
@ -188,7 +190,7 @@ _data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_emmtq"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_emmtq"]
|
||||||
size = Vector3(0.542114, 0.355225, 0.0774612)
|
size = Vector3(0.542114, 0.355225, 0.091465)
|
||||||
|
|
||||||
[node name="Menu" type="StaticBody3D"]
|
[node name="Menu" type="StaticBody3D"]
|
||||||
collision_layer = 6
|
collision_layer = 6
|
||||||
|
@ -196,7 +198,7 @@ collision_mask = 6
|
||||||
script = ExtResource("1_ng4u3")
|
script = ExtResource("1_ng4u3")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, -0.005)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, -0.015666)
|
||||||
shape = SubResource("BoxShape3D_e1esh")
|
shape = SubResource("BoxShape3D_e1esh")
|
||||||
|
|
||||||
[node name="Movable" type="Node" parent="."]
|
[node name="Movable" type="Node" parent="."]
|
||||||
|
@ -303,5 +305,13 @@ collision_mask = 0
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0299683, 0, 0.00889969)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0299683, 0, 0.0018978)
|
||||||
shape = SubResource("BoxShape3D_emmtq")
|
shape = SubResource("BoxShape3D_emmtq")
|
||||||
|
|
||||||
|
[node name="OpenSound" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource("12_dsnuc")
|
||||||
|
volume_db = -6.0
|
||||||
|
|
||||||
|
[node name="CloseSound" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource("13_nnnln")
|
||||||
|
volume_db = -6.0
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
extends AudioStreamPlayer
|
|
||||||
|
|
||||||
const click_sound = preload ("res://assets/sound/click.wav")
|
|
||||||
const spawn_sound = preload ("res://assets/sound/spawn.wav")
|
|
||||||
const open_menu = preload ("res://assets/sound/open_menu.wav")
|
|
||||||
const close_menu = preload ("res://assets/sound/close_menu.wav")
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
volume_db = -18
|
|
||||||
|
|
||||||
## Plays a given sound effect
|
|
||||||
func play_effect(sound):
|
|
||||||
if sound == "click":
|
|
||||||
stream = click_sound
|
|
||||||
volume_db = -18
|
|
||||||
elif sound == "spawn":
|
|
||||||
stream = spawn_sound
|
|
||||||
volume_db = -10
|
|
||||||
elif sound == "open_menu":
|
|
||||||
stream = open_menu
|
|
||||||
volume_db = -6
|
|
||||||
elif sound == "close_menu":
|
|
||||||
stream = close_menu
|
|
||||||
volume_db = -6
|
|
||||||
|
|
||||||
play()
|
|
|
@ -13,9 +13,6 @@ enum EventType {
|
||||||
TRIGGER,
|
TRIGGER,
|
||||||
}
|
}
|
||||||
|
|
||||||
signal on_press(type: EventType)
|
|
||||||
signal on_release(type: EventType)
|
|
||||||
|
|
||||||
var node: Node3D
|
var node: Node3D
|
||||||
var type: Type
|
var type: Type
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,6 @@ func _init(initiator: Initiator, ray: RayCast3D):
|
||||||
self.initiator = initiator
|
self.initiator = initiator
|
||||||
self.ray = ray
|
self.ray = ray
|
||||||
|
|
||||||
func _ready():
|
|
||||||
initiator.on_press.connect(_on_pressed)
|
|
||||||
initiator.on_release.connect(_on_released)
|
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
_handle_enter_leave()
|
_handle_enter_leave()
|
||||||
_handle_move()
|
_handle_move()
|
||||||
|
@ -56,7 +52,7 @@ func _handle_enter_leave():
|
||||||
|
|
||||||
last_collided = collider
|
last_collided = collider
|
||||||
|
|
||||||
func _on_pressed(type: Initiator.EventType):
|
func pressed(type: Initiator.EventType):
|
||||||
var collider = ray.get_collider()
|
var collider = ray.get_collider()
|
||||||
|
|
||||||
if collider == null:
|
if collider == null:
|
||||||
|
@ -73,7 +69,7 @@ func _on_pressed(type: Initiator.EventType):
|
||||||
click_point = ray.get_collision_point()
|
click_point = ray.get_collision_point()
|
||||||
_emit_event("grab_down", collider)
|
_emit_event("grab_down", collider)
|
||||||
|
|
||||||
func _on_released(type: Initiator.EventType):
|
func released(type: Initiator.EventType):
|
||||||
match type:
|
match type:
|
||||||
Initiator.EventType.TRIGGER:
|
Initiator.EventType.TRIGGER:
|
||||||
if is_pressed:
|
if is_pressed:
|
||||||
|
|
65
app/lib/utils/screenshot.gd
Normal file
65
app/lib/utils/screenshot.gd
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
const photo_sound_stream = preload ("res://assets/sound/camera-shutter.mp3")
|
||||||
|
|
||||||
|
var timer = Timer.new()
|
||||||
|
var photo_sound = AudioStreamPlayer.new()
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
timer.wait_time = 2
|
||||||
|
timer.one_shot = true
|
||||||
|
|
||||||
|
photo_sound.stream = photo_sound_stream
|
||||||
|
photo_sound.volume_db = -10
|
||||||
|
|
||||||
|
EventSystem.on_action_down.connect(func(action):
|
||||||
|
if action.name == "ax_button":
|
||||||
|
timer.start()
|
||||||
|
)
|
||||||
|
|
||||||
|
timer.timeout.connect(func():
|
||||||
|
EventSystem.notify("Screenshot taken", EventNotify.Type.INFO)
|
||||||
|
take_screenshot()
|
||||||
|
)
|
||||||
|
|
||||||
|
add_child(timer)
|
||||||
|
add_child(photo_sound)
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventKey and Input.is_key_pressed(KEY_F2):
|
||||||
|
timer.start()
|
||||||
|
|
||||||
|
func take_screenshot():
|
||||||
|
var file_name = "%s.png" % Time.get_datetime_string_from_system().replace(":", "-")
|
||||||
|
|
||||||
|
var path = OS.get_system_dir(OS.SYSTEM_DIR_PICTURES) + "/immersive-home/" + file_name
|
||||||
|
|
||||||
|
print("Saving screenshot to: %s" % path)
|
||||||
|
|
||||||
|
if not FileAccess.file_exists(path):
|
||||||
|
var dir = path.get_base_dir()
|
||||||
|
DirAccess.open("user://").make_dir_recursive(dir)
|
||||||
|
|
||||||
|
var image
|
||||||
|
|
||||||
|
if OS.get_name() == "Android":
|
||||||
|
var viewport_rid = get_viewport().get_viewport_rid()
|
||||||
|
var texture_rid = RenderingServer.viewport_get_texture(viewport_rid)
|
||||||
|
image = RenderingServer.texture_2d_layer_get(texture_rid, 0)
|
||||||
|
print(image)
|
||||||
|
|
||||||
|
if image == null:
|
||||||
|
return false
|
||||||
|
|
||||||
|
else:
|
||||||
|
var vp = get_viewport()
|
||||||
|
var texture = vp.get_texture()
|
||||||
|
image = texture.get_image()
|
||||||
|
|
||||||
|
if image == null:
|
||||||
|
return false
|
||||||
|
|
||||||
|
image.save_png(path)
|
||||||
|
photo_sound.play()
|
||||||
|
|
||||||
|
return true
|
|
@ -22,7 +22,6 @@ driver/enable_input=true
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
XRToolsUserSettings="*res://addons/godot-xr-tools/user_settings/user_settings.gd"
|
XRToolsUserSettings="*res://addons/godot-xr-tools/user_settings/user_settings.gd"
|
||||||
AudioPlayer="*res://lib/globals/audio_player.gd"
|
|
||||||
HomeApi="*res://lib/globals/home_api.gd"
|
HomeApi="*res://lib/globals/home_api.gd"
|
||||||
Store="*res://lib/globals/main_store.gd"
|
Store="*res://lib/globals/main_store.gd"
|
||||||
EventSystem="*res://lib/globals/event_system.gd"
|
EventSystem="*res://lib/globals/event_system.gd"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user