1 package net.sourceforge.simplegamenet.framework.model; 2 3 import net.sourceforge.simplegamenet.specs.model.Engine; 4 import net.sourceforge.simplegamenet.specs.model.GameFactory; 5 import net.sourceforge.simplegamenet.specs.to.GameSettings; 6 import net.sourceforge.simplegamenet.specs.to.PlayerSettingsMap; 7 8 public abstract class EngineImpl implements Engine { 9 10 protected static final int GAME_NOT_PLAYING = 0; 11 protected static final int GAME_STARTING = 1; 12 protected static final int GAME_PLAYING = 10; 13 protected static final int GAME_STOPPING = 20; 14 protected static final int GAME_ABORTING = 21; 15 16 protected GameFactory gameFactory; 17 protected GameSettings gameSettings; 18 protected PlayerSettingsMap playerSettingsMap; 19 20 protected int gameState = GAME_NOT_PLAYING; 21 22 protected EngineImpl(GameFactory gameFactory, GameSettings gameSettings, 23 PlayerSettingsMap playerSettingsMap) { 24 this.gameFactory = gameFactory; 25 this.gameSettings = gameSettings; 26 gameSettings.setEngine(this); 27 this.playerSettingsMap = playerSettingsMap; 28 } 29 30 public GameFactory getGameFactory() { 31 return gameFactory; 32 } 33 34 public GameSettings getGameSettings() { 35 return gameSettings; 36 } 37 38 public PlayerSettingsMap getPlayerSettingsMap() { 39 return playerSettingsMap; 40 } 41 42 public boolean isGamePlaying() { 43 return gameState == GAME_PLAYING || gameState == GAME_STARTING; 44 } 45 46 }