25 lines
381 B
GDScript
25 lines
381 B
GDScript
extends Node
|
|
|
|
var periods = []
|
|
var last_period = null
|
|
|
|
|
|
func add(date):
|
|
if last_period != null:
|
|
last_period.end = date
|
|
last_period = null
|
|
dump()
|
|
return
|
|
|
|
# If no new period has begun
|
|
var period = Period.new()
|
|
period.begin = date
|
|
periods.append(period)
|
|
last_period = period
|
|
dump()
|
|
|
|
|
|
func dump():
|
|
for period in periods:
|
|
print("%s - %s" % [period.begin, period.end])
|