public class Trigger extends CollisionEntity implements IUpdateable
Modifier and Type | Class and Description |
---|---|
static class |
Trigger.TriggerActivation |
ANY_MESSAGE
Constructor and Description |
---|
Trigger(Trigger.TriggerActivation activation,
java.lang.String message)
Instantiates a new
Trigger entity. |
Trigger(Trigger.TriggerActivation activation,
java.lang.String message,
boolean isOneTime)
Instantiates a new
Trigger entity. |
Trigger(Trigger.TriggerActivation activation,
java.lang.String message,
boolean isOneTime,
int cooldown)
Initializes a new instance of the
Trigger class. |
Trigger(Trigger.TriggerActivation activation,
java.lang.String name,
java.lang.String message)
Instantiates a new
Trigger entity. |
Trigger(Trigger.TriggerActivation activation,
java.lang.String name,
java.lang.String message,
boolean isOneTime)
Instantiates a new
Trigger entity. |
Modifier and Type | Method and Description |
---|---|
void |
addActivatedListener(TriggerActivatedListener listener) |
void |
addActivatingCondition(TriggerActivatingCondition condition) |
void |
addActivator(IEntity activator) |
void |
addActivator(int mapId) |
void |
addDeactivatedListener(TriggerDeactivatedListener listener) |
void |
addTarget(IEntity target) |
void |
addTarget(int mapId) |
void |
addTriggerListener(TriggerListener listener) |
boolean |
canTrigger(ICollisionEntity entity)
Checks whether the specified entity can interact with this trigger.
|
Trigger.TriggerActivation |
getActivationType() |
java.util.List<java.lang.Integer> |
getActivators() |
int |
getCooldown() |
java.lang.String |
getMessage() |
java.util.List<java.lang.Integer> |
getTargets() |
boolean |
interact(IEntity sender) |
boolean |
isActivated() |
boolean |
isOneTimeTrigger() |
void |
removeActivatedListener(TriggerActivatedListener listener) |
void |
removeActivatingCondition(TriggerActivatingCondition condition) |
void |
removeDeactivatedListener(TriggerDeactivatedListener listener) |
void |
removeTriggerListener(TriggerListener listener) |
void |
setCooldown(int cooldown) |
void |
setHeight(double height) |
void |
setMessage(java.lang.String message) |
void |
setSize(double width,
double height) |
void |
setWidth(double width) |
void |
update()
This method is called by the game loop on all objects that are attached to the loop.
|
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, hasCollision, onCollision, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionType, setLocation
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeEntityRenderedListener, removeEntityRenderListener, removeListener, removeMessageListener, removeTag, removeTransformListener, rendered, rendering, renderWithLayer, sendMessage, setAngle, setController, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setVisible, setX, setY, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, detachControllers, getAngle, getBoundingBox, getCenter, getController, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeEntityRenderedListener, removeEntityRenderListener, removeListener, removeMessageListener, removeTag, removeTransformListener, renderWithLayer, sendMessage, setAngle, setController, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setVisible, setX, setY
public Trigger(Trigger.TriggerActivation activation, java.lang.String message)
Trigger
entity.activation
- The activation method for this trigger.message
- The message that gets sent by this trigger upon activation.public Trigger(Trigger.TriggerActivation activation, java.lang.String name, java.lang.String message)
Trigger
entity.activation
- The activation method for this trigger.name
- The name of this trigger.message
- The message that gets sent by this trigger upon activation.public Trigger(Trigger.TriggerActivation activation, java.lang.String message, boolean isOneTime)
Trigger
entity.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.public Trigger(Trigger.TriggerActivation activation, java.lang.String name, java.lang.String message, boolean isOneTime)
Trigger
entity.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.public Trigger(Trigger.TriggerActivation activation, java.lang.String message, boolean isOneTime, int cooldown)
Trigger
class.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.public void addTriggerListener(TriggerListener listener)
public void removeTriggerListener(TriggerListener listener)
public void addActivatedListener(TriggerActivatedListener listener)
public void removeActivatedListener(TriggerActivatedListener listener)
public void addActivatingCondition(TriggerActivatingCondition condition)
public void removeActivatingCondition(TriggerActivatingCondition condition)
public void addDeactivatedListener(TriggerDeactivatedListener listener)
public void removeDeactivatedListener(TriggerDeactivatedListener listener)
public void addActivator(int mapId)
public void addActivator(IEntity activator)
public void addTarget(int mapId)
public void addTarget(IEntity target)
public Trigger.TriggerActivation getActivationType()
public java.util.List<java.lang.Integer> getActivators()
public java.lang.String getMessage()
public java.util.List<java.lang.Integer> getTargets()
public int getCooldown()
public boolean canTrigger(ICollisionEntity entity)
entity
- The entity.public boolean isOneTimeTrigger()
public boolean isActivated()
public boolean interact(IEntity sender)
public void setMessage(java.lang.String message)
public void setHeight(double height)
setHeight
in interface IEntity
setHeight
in class CollisionEntity
public void setWidth(double width)
setWidth
in interface IEntity
setWidth
in class CollisionEntity
public void setSize(double width, double height)
setSize
in interface IEntity
setSize
in class CollisionEntity
public void setCooldown(int cooldown)
public void update()
IUpdateable
ClientConfiguration
.update
in interface IUpdateable
ClientConfiguration.setMaxFps(int)