137 lines
3.4 KiB
Plaintext
Executable File
137 lines
3.4 KiB
Plaintext
Executable File
[gd_scene load_steps=11 format=2]
|
|
|
|
[ext_resource path="res://entities/light_switch/light_switch.dae" type="PackedScene" id=1]
|
|
|
|
[sub_resource type="GDScript" id=1]
|
|
script/source = "
|
|
extends Spatial
|
|
|
|
export (NodePath) var light_1
|
|
var node_1
|
|
export (NodePath) var light_2
|
|
var node_2
|
|
|
|
func _ready():
|
|
node_1 = get_node(light_1)
|
|
"
|
|
|
|
[sub_resource type="SpatialMaterial" id=3]
|
|
metallic = 1.0
|
|
roughness = 0.3
|
|
|
|
[sub_resource type="SpatialMaterial" id=2]
|
|
metallic_specular = 1.0
|
|
roughness = 0.2
|
|
|
|
[sub_resource type="Animation" id=7]
|
|
resource_name = "switch_1_off"
|
|
length = 0.01
|
|
tracks/0/type = "value"
|
|
tracks/0/path = NodePath("Cube.1:rotation_degrees")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/keys = {
|
|
"times": PoolRealArray( 0 ),
|
|
"transitions": PoolRealArray( 1 ),
|
|
"update": 0,
|
|
"values": [ Vector3( 0, 0, -9.99999 ) ]
|
|
}
|
|
|
|
[sub_resource type="Animation" id=8]
|
|
resource_name = "switch_1_on"
|
|
length = 0.01
|
|
tracks/0/type = "value"
|
|
tracks/0/path = NodePath("Cube.1:rotation_degrees")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/keys = {
|
|
"times": PoolRealArray( 0 ),
|
|
"transitions": PoolRealArray( 1 ),
|
|
"update": 0,
|
|
"values": [ Vector3( 0, 0, 9.99999 ) ]
|
|
}
|
|
|
|
[sub_resource type="Animation" id=9]
|
|
resource_name = "switch_2_off"
|
|
length = 0.01
|
|
tracks/0/type = "value"
|
|
tracks/0/path = NodePath("Cube.2:rotation_degrees")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/keys = {
|
|
"times": PoolRealArray( 0 ),
|
|
"transitions": PoolRealArray( 1 ),
|
|
"update": 0,
|
|
"values": [ Vector3( 0, 0, -9.99999 ) ]
|
|
}
|
|
|
|
[sub_resource type="Animation" id=10]
|
|
resource_name = "switch_2_on"
|
|
length = 0.01
|
|
tracks/0/type = "value"
|
|
tracks/0/path = NodePath("Cube.2:rotation_degrees")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/keys = {
|
|
"times": PoolRealArray( 0 ),
|
|
"transitions": PoolRealArray( 1 ),
|
|
"update": 0,
|
|
"values": [ Vector3( 0, 0, 9.99999 ) ]
|
|
}
|
|
|
|
[sub_resource type="GDScript" id=4]
|
|
script/source = "
|
|
extends StaticBody
|
|
|
|
var on = true
|
|
|
|
func interact(_relate):
|
|
if on:
|
|
on = false
|
|
get_parent().node_1.hide()
|
|
get_node(\"../AnimationPlayer\").play(\"switch_1_off\")
|
|
else:
|
|
on = true
|
|
get_parent().node_1.show()
|
|
get_node(\"../AnimationPlayer\").play(\"switch_1_on\")
|
|
"
|
|
|
|
[sub_resource type="BoxShape" id=5]
|
|
extents = Vector3( 0.105475, 1, 0.217155 )
|
|
|
|
[node name="light_switch" instance=ExtResource( 1 )]
|
|
script = SubResource( 1 )
|
|
|
|
[node name="Cube2" parent="." index="0"]
|
|
transform = Transform( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
|
|
|
|
[node name="Cube1" parent="." index="1"]
|
|
transform = Transform( 0.984808, -0.173648, 0, 0.173648, 0.984808, 0, 0, 0, 2, 0.099, 0, 0 )
|
|
|
|
[node name="Cylinder" parent="." index="3"]
|
|
material/0 = SubResource( 3 )
|
|
|
|
[node name="Cube" parent="." index="4"]
|
|
material/0 = SubResource( 2 )
|
|
|
|
[node name="AnimationPlayer" parent="." index="5"]
|
|
anims/switch_1_off = SubResource( 7 )
|
|
anims/switch_1_on = SubResource( 8 )
|
|
anims/switch_2_off = SubResource( 9 )
|
|
anims/switch_2_on = SubResource( 10 )
|
|
|
|
[node name="Switch Light" type="StaticBody" parent="." index="6"]
|
|
script = SubResource( 4 )
|
|
|
|
[node name="CollisionShape" type="CollisionShape" parent="Switch Light" index="0"]
|
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 2.5, 0.047, 0, 0 )
|
|
shape = SubResource( 5 )
|