Skip to content

Commit 2764a36

Browse files
xXxhaxmeister42xXxmarkus-wa
authored andcommitted
GameState: add getter for gamePhase (#136)
1 parent b8cd2cb commit 2764a36

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

fake/game_state.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ func (gs *GameState) TotalRoundsPlayed() int {
6565
return gs.Called().Int(0)
6666
}
6767

68+
// GamePhase is a mock-implementation of IGameState.GamePhase().
69+
func (gs *GameState) GamePhase() common.GamePhase {
70+
return gs.Called().Get(0).(common.GamePhase)
71+
}
72+
6873
// IsWarmupPeriod is a mock-implementation of IGameState.IsWarmupPeriod().
6974
func (gs *GameState) IsWarmupPeriod() bool {
7075
return gs.Called().Bool(0)

game_state.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ func (gs GameState) TotalRoundsPlayed() int {
106106
return gs.totalRoundsPlayed
107107
}
108108

109+
// GamePhase returns the game phase of the current game state. See common/gamerules.go for more.
110+
func (gs GameState) GamePhase() common.GamePhase {
111+
return gs.gamePhase
112+
}
113+
109114
// IsWarmupPeriod returns whether the game is currently in warmup period according to CCSGameRulesProxy.
110115
func (gs GameState) IsWarmupPeriod() bool {
111116
return gs.isWarmupPeriod

game_state_interface.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type IGameState interface {
4444
Bomb() *common.Bomb
4545
// TotalRoundsPlayed returns the amount of total rounds played according to CCSGameRulesProxy.
4646
TotalRoundsPlayed() int
47+
// GamePhase returns the game phase of the current game state. See common/gamerules.go for more.
48+
GamePhase() common.GamePhase
4749
// IsWarmupPeriod returns whether the game is currently in warmup period according to CCSGameRulesProxy.
4850
IsWarmupPeriod() bool
4951
// IsMatchStarted returns whether the match has started according to CCSGameRulesProxy.

0 commit comments

Comments
 (0)