42 lines
720 B
Go
42 lines
720 B
Go
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()
|
|
|
|
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)
|
|
|
|
err = gm.changeGameState(STATE_READY_SET, STATE_PLAY, PHASE_NONE)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
gm.runRound()
|
|
}
|