init
This commit is contained in:
commit
7cc71fb719
13 changed files with 840 additions and 0 deletions
21
internal/challenge/timers.go
Normal file
21
internal/challenge/timers.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue