Class CityEngine
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.AbstractEngine
-
- ch.sahits.game.openpatrician.engine.land.city.CityEngine
-
@Component @Lazy @DependentInitialisation(ch.sahits.game.openpatrician.model.initialisation.MapInitializedBean.class) public class CityEngine extends AbstractEngine
The CityEngine drives/generates the events that are based in the city. Mainly these are:- Consume of wares
- Production of wares from workshops owned by the city
- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Nov 28, 2011
-
-
Constructor Summary
Constructors Constructor Description CityEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TavernEnginefindTavernEngine()Find the tafern engine for the matching city.java.util.List<AbstractEngine>getChildren()Any engine may hold various child engines.ShipyardEnginegetShipyardEngine()voidhandleCityAdd(ch.sahits.game.openpatrician.model.event.FoundingCityBecomesAccessible event)Handle the event where a new city is added to the map.voidhandleClockTicked(ch.sahits.game.event.data.ClockTick event)voidhandleClockTickIntervallChange(ch.sahits.game.event.data.ClockTickIntervalChange event)voidhandleDailyUpdate(ch.sahits.game.event.data.PeriodicalDailyUpdate event)voidhandleShipArrival(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)voidhandleShipDeparture(ch.sahits.game.openpatrician.event.data.ShipLeavingPort event)voidinitialize()voidstart(ch.sahits.game.openpatrician.model.IGame game)Start the engine.
-
-
-
Method Detail
-
initialize
@PostConstruct public void initialize()
-
handleClockTickIntervallChange
public void handleClockTickIntervallChange(ch.sahits.game.event.data.ClockTickIntervalChange event)
-
handleClockTicked
public void handleClockTicked(ch.sahits.game.event.data.ClockTick event)
-
start
public void start(ch.sahits.game.openpatrician.model.IGame game)
Start the engine. This should be called after all cities were added.- Parameters:
game- that is started
-
getChildren
public java.util.List<AbstractEngine> getChildren()
Description copied from class:AbstractEngineAny 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:
getChildrenin classAbstractEngine- Returns:
- list of child engines.
-
getShipyardEngine
public ShipyardEngine getShipyardEngine()
-
findTavernEngine
public TavernEngine findTavernEngine()
Find the tafern engine for the matching city.- Returns:
- TavernEngine for this CityEngine.
-
handleCityAdd
public void handleCityAdd(ch.sahits.game.openpatrician.model.event.FoundingCityBecomesAccessible event)
Handle the event where a new city is added to the map.- Parameters:
event- founded city becomes available for trading
-
handleShipArrival
public void handleShipArrival(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)
-
handleShipDeparture
public void handleShipDeparture(ch.sahits.game.openpatrician.event.data.ShipLeavingPort event)
-
handleDailyUpdate
public void handleDailyUpdate(ch.sahits.game.event.data.PeriodicalDailyUpdate event)
-
-