Class SeafaringService


  • @Component
    @Lazy
    @DependentInitialisation(ch.sahits.game.openpatrician.model.initialisation.StartNewGameBean.class)
    public class SeafaringService
    extends java.lang.Object
    Service keeping track of all the ships that are traveling.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jan 04, 2016
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.google.common.eventbus.AsyncEventBus clientServerEventBus  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void travelBetweenCities​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, ch.sahits.game.openpatrician.model.city.ICity toCity)
      Travel from one city to another.
      void travelFromCity​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, javafx.geometry.Point2D location)
      Travel from a city to a place that is not a city.
      void travelNotBetweenCities​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, javafx.geometry.Point2D location)
      Travel between two locations, where neither is a city.
      java.util.List<javafx.geometry.Point2D> travelTo​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, javafx.geometry.Point2D destination)
      Send a ship or convoy on its way to a destination.
      void travelToCity​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, ch.sahits.game.openpatrician.model.city.ICity toCity)
      Travel from a location that is not a city to a city.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • clientServerEventBus

        @Autowired
        @Qualifier("serverClientEventBus")
        protected com.google.common.eventbus.AsyncEventBus clientServerEventBus
    • Constructor Detail

      • SeafaringService

        public SeafaringService()
    • Method Detail

      • travelTo

        public java.util.List<javafx.geometry.Point2D> travelTo​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel,
                                                                javafx.geometry.Point2D destination)
        Send a ship or convoy on its way to a destination.
        Parameters:
        vessel - that is sent
        destination - of the travel
        Returns:
        list of points defining the path.
      • travelBetweenCities

        public void travelBetweenCities​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel,
                                        ch.sahits.game.openpatrician.model.city.ICity toCity)
        Travel from one city to another.
        Parameters:
        vessel - which travels between cities
        toCity - destination city
      • travelToCity

        public void travelToCity​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel,
                                 ch.sahits.game.openpatrician.model.city.ICity toCity)
        Travel from a location that is not a city to a city.
        Parameters:
        vessel - traveling to a city
        toCity - destination city
      • travelNotBetweenCities

        public void travelNotBetweenCities​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel,
                                           javafx.geometry.Point2D location)
        Travel between two locations, where neither is a city.
        Parameters:
        vessel - travelling between two locations at sea
        location - destination location
      • travelFromCity

        public void travelFromCity​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel,
                                   javafx.geometry.Point2D location)
        Travel from a city to a place that is not a city.
        Parameters:
        vessel - traveling from a city to a location at sea
        location - destination location