Class PlayerEngine
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.AbstractEngine
-
- ch.sahits.game.openpatrician.engine.player.PlayerEngine
-
public class PlayerEngine extends AbstractEngine
Base engine representing a player. If the player is AI the correseponding engine will be a subclass of this engine.- Author:
- Andi Hotz, (c) Sahits GmbH, 2015 Created on Jun 16, 2015
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.eventbus.AsyncEventBus
clientServerEventBus
private double
dailySailorCost
private HumanPlayerEngine
humanPlayerEngine
private IMap
map
private PlayerList
players
private DependentPropertyInitializer
propertyInitializer
private ReputationCalculator
repCalc
private com.google.common.eventbus.AsyncEventBus
timerEventBus
private TravellingVessels
vessels
-
Constructor Summary
Constructors Constructor Description PlayerEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
dailyUpdateBalanceSheet()
java.util.List<AbstractEngine>
getChildren()
Any engine may hold various child engines.void
handleDailyUpdate(ClockTickDayChange event)
void
handleShipArrivalInCity(ShipEntersPortEvent event)
void
handleShipReachesDestination(ShipArrivesAtDestinationEvent event)
void
handleWeeklyUpdate(ClockTickDayChange event)
Handling the daily update events.private void
init()
private void
unregister()
(package private) void
updateCompanyValue()
-
-
-
Field Detail
-
dailySailorCost
@DependentValue("sailor.cost.per.day") private double dailySailorCost
-
players
@Autowired private PlayerList players
-
humanPlayerEngine
@Autowired private HumanPlayerEngine humanPlayerEngine
-
map
@Autowired private IMap map
-
repCalc
@Autowired private ReputationCalculator repCalc
-
vessels
@Autowired private TravellingVessels vessels
-
clientServerEventBus
@Autowired @Qualifier("serverClientEventBus") private com.google.common.eventbus.AsyncEventBus clientServerEventBus
-
timerEventBus
@Autowired @Qualifier("timerEventBus") private com.google.common.eventbus.AsyncEventBus timerEventBus
-
propertyInitializer
@Autowired private DependentPropertyInitializer propertyInitializer
-
-
Method Detail
-
init
@PostConstruct private void init()
-
unregister
@PreDestroy private void unregister()
-
handleDailyUpdate
public void handleDailyUpdate(ClockTickDayChange event)
-
handleWeeklyUpdate
public void handleWeeklyUpdate(ClockTickDayChange event)
Handling the daily update events.- Parameters:
event
- day change update
-
updateCompanyValue
void updateCompanyValue()
-
getChildren
public java.util.List<AbstractEngine> getChildren()
Description copied from class:AbstractEngine
Any engine may hold various child engines. This is the way to retrieve them. If there are no child engines, return an empty list. Subclasses have to implement this in the proper way.- Specified by:
getChildren
in classAbstractEngine
- Returns:
- list of child engines.
-
dailyUpdateBalanceSheet
private void dailyUpdateBalanceSheet()
-
handleShipReachesDestination
public void handleShipReachesDestination(ShipArrivesAtDestinationEvent event)
-
handleShipArrivalInCity
public void handleShipArrivalInCity(ShipEntersPortEvent event)
-
-