GameState.kt 886 Bytes
Newer Older
1
2
3
4
5
package com.mygdx.game.model

/*
Holds the state of the game and all data related to this.
*/
6
class GameState(gameMode: GameMode) {
7

8
    private var gameMode: GameMode
9
10
    private var boardState: AbstractBoard
    private var rules: AbstractRules
11
    private var isStarted: Boolean
12
    private var winner: Int?
13
    private var isFinished: Boolean = false
14
15

    init {
16
        this.gameMode = gameMode
17
18
        this.rules = gameMode.getRules()
        this.boardState = gameMode.getBoard()
19
20
21
22
        this.isStarted = false
        this.winner = null
    }

23
    fun getBoardState(): AbstractBoard {
24
25
26
        return boardState
    }

27
    fun getRules(): AbstractRules {
28
29
30
        return rules
    }

Anders H. Rebner's avatar
Cleanup    
Anders H. Rebner committed
31
    fun getGameMode(): GameMode {
32
33
34
        return this.gameMode
    }

35
    fun setWinner(winner: Int) {
36
37
        this.winner = winner
    }
38
39
40
41

    fun setFinished() {
        isFinished = true
    }
42
}