21 lines
490 B
Go
21 lines
490 B
Go
package challenge
|
|
|
|
import "time"
|
|
|
|
func (e *Engine) startFloorTimer(p *Player, at time.Duration) {
|
|
if p.Floor >= 1 && p.Floor <= e.regularFloors && !e.floorCleared(p, p.Floor) {
|
|
p.floorTimerOn = true
|
|
p.floorTimerAt = at
|
|
}
|
|
}
|
|
|
|
func (e *Engine) pauseFloorTimer(p *Player, at time.Duration) {
|
|
if p.floorTimerOn {
|
|
p.FloorDurations[p.Floor] += at - p.floorTimerAt
|
|
p.floorTimerOn = false
|
|
}
|
|
}
|
|
|
|
func (e *Engine) finishFloorTimer(p *Player, at time.Duration) {
|
|
e.pauseFloorTimer(p, at)
|
|
}
|