Class TriggerMapObjectLoader

java.lang.Object
de.gurkenlabs.litiengine.environment.MapObjectLoader
de.gurkenlabs.litiengine.environment.TriggerMapObjectLoader
All Implemented Interfaces:
IMapObjectLoader

public class TriggerMapObjectLoader extends MapObjectLoader
  • Constructor Details

    • TriggerMapObjectLoader

      protected TriggerMapObjectLoader()
  • Method Details

    • registerCustomTriggerType

      public static <T extends Trigger> void registerCustomTriggerType(String name, Class<T> triggerType)

      Registers a custom Trigger implementation that can be automatically provided by this MapObjectLoader.

      Whenever a TRIGGER map object with a name equal to the specified name is loaded, an instance of the supplied triggerType is created instead of the default Trigger.

      Make sure that the implementation has one of the following constructors present:

      1. A constructor that matches the Trigger default constructor signature (Trigger.TriggerActivation, String, boolean, int).
      2. An empty constructor.
      Type Parameters:
      T - The type of the custom trigger implementation.
      Parameters:
      name - The map object name used to identify trigger instances that should be loaded as the specified triggerType.
      triggerType - The class of the custom Trigger implementation.
    • clearCustomTriggerTypes

      public static void clearCustomTriggerTypes()
      Removes all previously registered custom Trigger types.
      See Also:
    • load

      public Collection<IEntity> load(Environment environment, IMapObject mapObject)
      Description copied from interface: IMapObjectLoader
      Loads entities from the specified map object within the given environment.
      Parameters:
      environment - The environment in which the entities are being loaded.
      mapObject - The map object containing the data for the entities.
      Returns:
      A collection of IEntity instances loaded from the map object.
    • createTrigger

      protected Trigger createTrigger(IMapObject mapObject, Trigger.TriggerActivation act, String message, boolean oneTime, int coolDown)
    • loadTargets

      protected void loadTargets(IMapObject mapObject, Trigger trigger)
    • loadActivators

      protected void loadActivators(IMapObject mapObject, Trigger trigger)