Class ServiceLocator

java.lang.Object
com.csse3200.game.services.ServiceLocator

public class ServiceLocator extends Object
A simplified implementation of the Service Locator pattern: https://martinfowler.com/articles/injection.html#UsingAServiceLocator

Allows global access to a few core game services. Warning: global access is a trap and should be used extremely sparingly. Read the wiki for details (https://github.com/UQcsse3200/game-engine/wiki/Service-Locator).

  • Method Details

    • getGameArea

      public static GameArea getGameArea()
    • registerGameArea

      public static void registerGameArea(GameArea area)
    • getEntityService

      public static EntityService getEntityService()
    • getRenderService

      public static RenderService getRenderService()
    • getPhysicsService

      public static PhysicsService getPhysicsService()
    • getTimeSource

      public static GameTime getTimeSource()
    • getInputService

      public static InputService getInputService()
    • getResourceService

      public static ResourceService getResourceService()
    • getGameStateObserverService

      public static GameStateObserver getGameStateObserverService()
    • getStructurePlacementService

      public static StructurePlacementService getStructurePlacementService()
    • getTerrainService

      public static TerrainService getTerrainService()
    • getEntityPlacementService

      public static EntityPlacementService getEntityPlacementService()
    • registerStructurePlacementService

      public static void registerStructurePlacementService(StructurePlacementService service)
    • registerEntityPlacementService

      public static void registerEntityPlacementService(EntityPlacementService service)
    • registerEntityService

      public static void registerEntityService(EntityService service)
    • registerRenderService

      public static void registerRenderService(RenderService service)
    • registerPhysicsService

      public static void registerPhysicsService(PhysicsService service)
    • registerTimeSource

      public static void registerTimeSource(GameTime source)
    • registerInputService

      public static void registerInputService(InputService source)
    • registerResourceService

      public static void registerResourceService(ResourceService source)
    • registerTerrainService

      public static void registerTerrainService(TerrainService source)
    • registerGameStateObserverService

      public static void registerGameStateObserverService(GameStateObserver source)
    • clear

      public static void clear()