-
Notifications
You must be signed in to change notification settings - Fork 1
/
World.gd
46 lines (36 loc) · 1003 Bytes
/
World.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
extends Node2D
signal time_left_change
export var attacker1: NodePath
export var attacker2: NodePath
export var time_left := 90
onready var hunt_gate_wr := weakref($HUNT_GATE)
func _ready():
$atttack_door.play()
emit_signal("time_left_change", time_left)
func _process(delta):
if time_left > 0:
get_node(attacker1).attack(null)
get_node(attacker2).attack(null)
func _on_atttack_door_finished():
if time_left > 0:
$atttack_door.play()
func _on_Timer_timeout():
if time_left <= 0:
$Timer.stop()
start_hunt()
$Timer.start(5)
return
time_left -= 1
emit_signal("time_left_change", time_left)
func start_hunt():
if hunt_gate_wr.get_ref():
hunt_gate_wr.get_ref().queue_free()
var i = 0
for chaser in $chasers.get_children():
chaser.disabled = false
var path = Global.get_nav_path(chaser.position, $RigidPlayer.position)
chaser.set_path(path)
func _on_AudioStreamPlayer_finished():
$AudioStreamPlayer.play()
func _on_NextLevel_body_entered(body):
Global.goto_outro()