Class TriggerMapObjectLoader
java.lang.Object
de.gurkenlabs.litiengine.environment.MapObjectLoader
de.gurkenlabs.litiengine.environment.TriggerMapObjectLoader
- All Implemented Interfaces:
IMapObjectLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRemoves all previously registered customTriggertypes.protected TriggercreateTrigger(IMapObject mapObject, Trigger.TriggerActivation act, String message, boolean oneTime, int coolDown) load(Environment environment, IMapObject mapObject) Loads entities from the specified map object within the given environment.protected voidloadActivators(IMapObject mapObject, Trigger trigger) protected voidloadTargets(IMapObject mapObject, Trigger trigger) static <T extends Trigger>
voidregisterCustomTriggerType(String name, Class<T> triggerType) Registers a customTriggerimplementation that can be automatically provided by thisMapObjectLoader.Methods inherited from class MapObjectLoader
afterLoad, getMapObjectType, isMatchingType, loadDefaultProperties
-
Constructor Details
-
TriggerMapObjectLoader
protected TriggerMapObjectLoader()
-
-
Method Details
-
registerCustomTriggerType
Registers a custom
Triggerimplementation that can be automatically provided by thisMapObjectLoader.Whenever a TRIGGER map object with a name equal to the specified
nameis loaded, an instance of the suppliedtriggerTypeis created instead of the defaultTrigger.Make sure that the implementation has one of the following constructors present:
- A constructor that matches the
Triggerdefault constructor signature (Trigger.TriggerActivation,String,boolean,int). - 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 specifiedtriggerType.triggerType- The class of the customTriggerimplementation.
- A constructor that matches the
-
clearCustomTriggerTypes
public static void clearCustomTriggerTypes()Removes all previously registered customTriggertypes.- See Also:
-
load
Description copied from interface:IMapObjectLoaderLoads 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
IEntityinstances loaded from the map object.
-
createTrigger
protected Trigger createTrigger(IMapObject mapObject, Trigger.TriggerActivation act, String message, boolean oneTime, int coolDown) -
loadTargets
-
loadActivators
-