Class Trigger

All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, ICollisionEntity, IEntity, IUpdateable, Tweenable, EventListener

public class Trigger extends CollisionEntity implements IUpdateable
TODO: Triggers should be able to call entity actions (similar to the current message approach)
  • Constructor Details

    • Trigger

      public Trigger(Trigger.TriggerActivation activation, String message)
      Instantiates a new Trigger entity.
      Parameters:
      activation - The activation method for this trigger.
      message - The message that gets sent by this trigger upon activation.
    • Trigger

      public Trigger(Trigger.TriggerActivation activation, String name, String message)
      Instantiates a new Trigger entity.
      Parameters:
      activation - The activation method for this trigger.
      name - The name of this trigger.
      message - The message that gets sent by this trigger upon activation.
    • Trigger

      public Trigger(Trigger.TriggerActivation activation, String message, boolean isOneTime)
      Instantiates a new Trigger entity.
      Parameters:
      activation - The activation method for this trigger.
      message - The message that gets sent by this trigger upon activation.
      isOneTime - A flag, indicating whether this instance can only be triggered once.
    • Trigger

      public Trigger(Trigger.TriggerActivation activation, String name, String message, boolean isOneTime)
      Instantiates a new Trigger entity.
      Parameters:
      activation - The activation method for this trigger.
      name - The name of this trigger.
      message - The message that gets sent by this trigger upon activation.
      isOneTime - A flag, indicating whether this instance can only be triggered once.
    • Trigger

      public Trigger(Trigger.TriggerActivation activation, String message, boolean isOneTime, int cooldown)
      Initializes a new instance of the Trigger class.
      Parameters:
      activation - The activation method for this trigger.
      message - The message that gets sent by this trigger upon activation.
      isOneTime - A flag, indicating whether this instance can only be triggered once.
      cooldown - The cooldown that needs to be respected between two activation events.
  • Method Details

    • addTriggerListener

      public void addTriggerListener(TriggerListener listener)
    • removeTriggerListener

      public void removeTriggerListener(TriggerListener listener)
    • addActivatedListener

      public void addActivatedListener(TriggerActivatedListener listener)
    • removeActivatedListener

      public void removeActivatedListener(TriggerActivatedListener listener)
    • addActivatingCondition

      public void addActivatingCondition(TriggerActivatingCondition condition)
    • removeActivatingCondition

      public void removeActivatingCondition(TriggerActivatingCondition condition)
    • addDeactivatedListener

      public void addDeactivatedListener(TriggerDeactivatedListener listener)
    • removeDeactivatedListener

      public void removeDeactivatedListener(TriggerDeactivatedListener listener)
    • addActivator

      public void addActivator(int mapId)
    • addActivator

      public void addActivator(IEntity activator)
    • addTarget

      public void addTarget(int mapId)
    • addTarget

      public void addTarget(IEntity target)
    • getActivationType

      public Trigger.TriggerActivation getActivationType()
    • getActivators

      public List<Integer> getActivators()
    • getMessage

      public String getMessage()
    • getTargets

      public List<Integer> getTargets()
    • getCooldown

      public int getCooldown()
    • canTrigger

      public boolean canTrigger(ICollisionEntity entity)
      Checks whether the specified entity can interact with this trigger.
      Parameters:
      entity - The entity.
      Returns:
      True if the entity can interact with the trigger; otherwise false.
    • isOneTimeTrigger

      public boolean isOneTimeTrigger()
    • isActivated

      public boolean isActivated()
    • interact

      public boolean interact(IEntity sender)
    • setMessage

      public void setMessage(String message)
    • setHeight

      public void setHeight(double height)
      Specified by:
      setHeight in interface IEntity
      Overrides:
      setHeight in class CollisionEntity
    • setWidth

      public void setWidth(double width)
      Specified by:
      setWidth in interface IEntity
      Overrides:
      setWidth in class CollisionEntity
    • setSize

      public void setSize(double width, double height)
      Specified by:
      setSize in interface IEntity
      Overrides:
      setSize in class CollisionEntity
    • setCooldown

      public void setCooldown(int cooldown)
    • update

      public void update()
      Description copied from interface: IUpdateable
      This method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using the ClientConfiguration.
      Specified by:
      update in interface IUpdateable
      See Also: