26 lines
383 B
GDScript3
26 lines
383 B
GDScript3
|
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])
|