-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameStats.gd
52 lines (41 loc) · 1 KB
/
GameStats.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
48
49
50
51
52
extends Node
var switch_tmp:Array
var stealed:Array
var all_stealable:Array #Array<StealableModel>
var time:float = 0.0
func _ready():
switch_tmp = []
stealed = []
all_stealable = [] #Array<StealableModel>
time = 0.0
func initialize(stealeables):
time = 0.0
all_stealable = stealeables
func reset():
for elem in switch_tmp:
elem.reset()
switch_tmp = []
for each in all_stealable:
each.reset()
func checkpoint():
switch_tmp = []
for each in all_stealable:
each.checkpoint()
func add_switch(elem:CameraSwitch):
if not switch_tmp.has(elem):
switch_tmp.append(elem)
func add_stealable(elem:Stealable):
get_stealable_by_id(elem.get_id()).steal()
func add_time(time_to_add:float):
time += time_to_add
func restart_game():
_ready()
func finish_game():
switch_tmp = []
for each in all_stealable:
each.checkpoint()
func get_stealable_by_id(id:String): # -> StealableModel
for each in all_stealable:
if each.id == id:
return each
printerr("No se encontro un robable con el id buscado")