26 lines
371 B
Text
26 lines
371 B
Text
|
|
import "math/event" for Event
|
||
|
|
|
||
|
|
class Time{
|
||
|
|
day:Num {_day}
|
||
|
|
onIncrease:Event {_onIncrease}
|
||
|
|
|
||
|
|
construct new(){
|
||
|
|
_day = 0
|
||
|
|
_onIncrease = Event.new()
|
||
|
|
}
|
||
|
|
|
||
|
|
increase(){
|
||
|
|
increase(1)
|
||
|
|
}
|
||
|
|
|
||
|
|
increase(amount: Num){
|
||
|
|
_day = _day + amount
|
||
|
|
for(i in 1..amount){
|
||
|
|
_onIncrease.emit([])
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
set(day: Num){
|
||
|
|
_day = day
|
||
|
|
}
|
||
|
|
}
|