Class Game
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.impl.Game
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.eventbus.AsyncEventBus
clientEventBus
private com.google.common.eventbus.AsyncEventBus
clientServerEventBus
private static boolean
constructed
private Difficulty
difficulty
private boolean
fastforward
private javafx.beans.property.ObjectProperty<EGameSpeed>
gameSpeed
private IMap
map
private EObjective
objective
private boolean
singleplayer
private Date
time
-
Constructor Summary
Constructors Constructor Description Game(EObjective objective, Difficulty difficulty, EGameSpeed speed, boolean singleplayer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fastForward()
Switch to fast forward until the first interuption.javafx.beans.property.ObjectProperty<EGameSpeed>
gameSpeedProperty()
Property for the game speed.EGameSpeed
getGameSpeed()
Retrieve the current game speedvoid
handleMessage(DisplayMessage message)
private void
init()
boolean
isObjectivReached()
check if the objective of the game is reached.boolean
isSinglePlayer()
Indicating that the game is a single player game.void
normalSpeed()
Return to normal speed.void
setGameSpeed(EGameSpeed speed)
Set a new game speedprivate void
setupGamespeed()
private void
unregister()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ch.sahits.game.openpatrician.model.IGame
getDifficulty, getMap
-
-
-
-
Field Detail
-
map
@Autowired private IMap map
-
objective
private final EObjective objective
-
difficulty
private final Difficulty difficulty
-
gameSpeed
private javafx.beans.property.ObjectProperty<EGameSpeed> gameSpeed
-
fastforward
private boolean fastforward
-
time
@Autowired private Date time
-
singleplayer
private boolean singleplayer
-
clientEventBus
@Autowired @Qualifier("clientEventBus") private com.google.common.eventbus.AsyncEventBus clientEventBus
-
clientServerEventBus
@Autowired @Qualifier("serverClientEventBus") private com.google.common.eventbus.AsyncEventBus clientServerEventBus
-
constructed
private static boolean constructed
-
-
Constructor Detail
-
Game
public Game(EObjective objective, Difficulty difficulty, EGameSpeed speed, boolean singleplayer)
-
-
Method Detail
-
init
@PostConstruct private void init()
-
setupGamespeed
private void setupGamespeed()
-
unregister
@PreDestroy private void unregister()
-
setGameSpeed
public void setGameSpeed(EGameSpeed speed)
Description copied from interface:IGame
Set a new game speed- Specified by:
setGameSpeed
in interfaceIGame
- Parameters:
speed
- new game speed.
-
handleMessage
public void handleMessage(DisplayMessage message)
-
normalSpeed
public void normalSpeed()
Description copied from interface:IGame
Return to normal speed.- Specified by:
normalSpeed
in interfaceIGame
-
fastForward
public void fastForward()
Description copied from interface:IGame
Switch to fast forward until the first interuption.- Specified by:
fastForward
in interfaceIGame
-
isObjectivReached
public boolean isObjectivReached()
Description copied from interface:IGame
check if the objective of the game is reached. This method may not be called by the server part- Specified by:
isObjectivReached
in interfaceIGame
- Returns:
- flag indicating of the game objective has been reached
-
isSinglePlayer
public boolean isSinglePlayer()
Description copied from interface:IGameType
Indicating that the game is a single player game.- Specified by:
isSinglePlayer
in interfaceIGameType
- Returns:
- true if the game is singleplayer.
-
getGameSpeed
public EGameSpeed getGameSpeed()
Description copied from interface:IGame
Retrieve the current game speed- Specified by:
getGameSpeed
in interfaceIGame
- Returns:
- current game speed
-
gameSpeedProperty
public javafx.beans.property.ObjectProperty<EGameSpeed> gameSpeedProperty()
Description copied from interface:IGame
Property for the game speed.- Specified by:
gameSpeedProperty
in interfaceIGame
- Returns:
- property of the current game speed.
-
-