Class PirateEngine
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.AbstractEngine
-
- ch.sahits.game.openpatrician.engine.sea.PirateEngine
-
@Lazy @Service @DependentInitialisation(ch.sahits.game.openpatrician.model.initialisation.StartNewGameBean.class) public class PirateEngine extends AbstractEngine
Engine governing all pirates.- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 29, 2013
-
-
Constructor Summary
Constructors Constructor Description PirateEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<AbstractEngine>getChildren()Any engine may hold various child engines.voidhandleNewPirate(ch.sahits.game.openpatrician.model.event.NewPirateEvent pirateEvent)Handle the even when a new pirate becomes available.voidhandleRepairFinished(ch.sahits.game.openpatrician.event.data.RepairFinishedEvent event)Handle the event for the finished repair.voidhandleRepairPirateShip(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)When a pirate ship enters a port it does so for repair.voidhandleShipPositionUpdate(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)Check if there is a ship near the new position and decide if an attack should be initiated.voidhandleShipReachesDestination(ch.sahits.game.openpatrician.event.data.ShipArrivesAtDestinationEvent event)Ship has reached it's destination, select a new one.voidhandleWeeklyUpdate(ch.sahits.game.event.data.PeriodicalTimeWeekEndUpdate event)Periodically check if there is a free pirate and if not, create one.voidinitializedGraph(ch.sahits.game.openpatrician.event.data.GraphInitialisationComplete event)
-
-
-
Method Detail
-
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.
-
initializedGraph
public void initializedGraph(ch.sahits.game.openpatrician.event.data.GraphInitialisationComplete event)
-
handleNewPirate
public void handleNewPirate(ch.sahits.game.openpatrician.model.event.NewPirateEvent pirateEvent)
Handle the even when a new pirate becomes available.- Parameters:
pirateEvent- new pirate emerged
-
handleShipReachesDestination
public void handleShipReachesDestination(ch.sahits.game.openpatrician.event.data.ShipArrivesAtDestinationEvent event)
Ship has reached it's destination, select a new one.- Parameters:
event- ship arrives at destination
-
handleShipPositionUpdate
public void handleShipPositionUpdate(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)
Check if there is a ship near the new position and decide if an attack should be initiated.- Parameters:
event- ship changes position
-
handleRepairPirateShip
public void handleRepairPirateShip(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)
When a pirate ship enters a port it does so for repair.
-
handleRepairFinished
public void handleRepairFinished(ch.sahits.game.openpatrician.event.data.RepairFinishedEvent event)
Handle the event for the finished repair.- Parameters:
event- repair has finished
-
handleWeeklyUpdate
public void handleWeeklyUpdate(ch.sahits.game.event.data.PeriodicalTimeWeekEndUpdate event)
Periodically check if there is a free pirate and if not, create one.- Parameters:
event- weekly update
-
-