-
Notifications
You must be signed in to change notification settings - Fork 0
/
dungeon_entry_point.gd
47 lines (35 loc) · 1.29 KB
/
dungeon_entry_point.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
extends Spatial
onready var fwd = get_node("dungeon-module-choice")
onready var lft = get_node("dungeon-module-choice2")
onready var rht = get_node("dungeon-module-choice3")
onready var start_area = get_node("module-4-way/start_area")
func _ready():
start_area.connect("body_entered", self ,"_on_body_entered_start_area")
Game.connect("on_dungeon_failed_from_dir", self, "_on_dungeon_failed_from_direction")
Game.connect("on_dungeon_reset", self, "_on_dungeon_reset")
Game.register_direction_entry(Game.Direction.Forward, fwd)
Game.register_direction_entry(Game.Direction.Left, lft)
Game.register_direction_entry(Game.Direction.Right, rht)
func _on_body_entered_start_area(body):
if body.name == "player" and Game.is_returning_to_start():
Game.set_returning_to_start(false)
func _on_dungeon_reset():
fwd.show_this_again()
lft.show_this_again()
rht.show_this_again()
func _on_dungeon_failed_from_direction(dir):
if dir == Game.Direction.Forward:
fwd.hide_this_for_now()
lft.show_this_again()
rht.show_this_again()
elif dir == Game.Direction.Left:
fwd.show_this_again()
rht.hide_this_for_now()
lft.show_this_again()
elif dir == Game.Direction.Right:
fwd.show_this_again()
rht.show_this_again()
lft.hide_this_for_now()
fwd.reset_this()
lft.reset_this()
rht.reset_this()