knowyt/server/src/game/nextRound.go

42 lines
720 B
Go
Raw Normal View History

2021-09-20 08:41:34 +00:00
package game
import (
"fmt"
"time"
)
func (gm *Game) nextRound() {
if err := gm.changeGamePhase(STATE_PLAY, PHASE_REVEAL_SOURCE, PHASE_ROUND_END); err != nil {
fmt.Println(err)
return
}
gm.notifyClients()
time.Sleep(2 * time.Second)
err := gm.changeGameState(STATE_PLAY, STATE_READY_SET, "Go!")
if err != nil {
fmt.Println(err)
return
}
gm.notifyClients()
2021-09-20 14:53:49 +00:00
time.Sleep(1500 * time.Millisecond)
err = gm.changeGameState(STATE_READY_SET, STATE_READY_SET, "")
if err != nil {
fmt.Println(err)
return
}
gm.notifyClients()
time.Sleep(1500 * time.Millisecond)
2021-09-20 08:41:34 +00:00
err = gm.changeGameState(STATE_READY_SET, STATE_PLAY, PHASE_NONE)
if err != nil {
fmt.Println(err)
return
}
gm.runRound()
}