Door control added

This commit is contained in:
Segey Lapin
2021-10-26 22:45:59 +03:00
parent 635974263f
commit f0fa3d5ca8
2 changed files with 39 additions and 0 deletions

27
scenes/door_control.gd Normal file
View File

@@ -0,0 +1,27 @@
extends Spatial
var marker_info = {
"marker_a1_door": {
"method": "open_door",
"door": "a1",
},
"marker_a2_door": {
"method": "open_door",
"door": "a1",
}
}
func _ready():
doors.register_door(self, "a1", get_parent(), Vector3.UP, 0, -PI/2.0, 2.0)
markers.init_markers(self, marker_info)
func _physics_process(delta):
pass
func _process(delta):
pass
func open_door(data):
var door = data.door
if doors.get_state(self, door) == 0:
doors.open_door(self, door)
elif doors.get_state(self, door) == 1:
doors.close_door(self, door)

12
scenes/door_control.tscn Normal file
View File

@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/door_control.gd" type="Script" id=1]
[node name="door_control" type="Spatial"]
script = ExtResource( 1 )
[node name="marker_a1_door" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.7, 0.471, 0.2 )
[node name="marker_a2_door" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.7, 0.471, -0.2 )