22 #ifndef FIFE_TRIGGER_H
23 #define FIFE_TRIGGER_H
41 class TriggerChangeListener;
103 Trigger(
const std::string& name);
222 void remove(
Cell* cell);
void detach()
Detaches trigger from instance.
TriggerChangeListener * m_changeListener
main change listener (cell and instance listener)
virtual ~ITriggerListener()
void move()
Callback for TriggerChangeListener.
void attach(Instance *instance)
Attaches the trigger to the given instance.
std::string m_name
name of the trigger. This should be unique per Map.
const std::string & getName() const
Gets the name of the trigger.
virtual ~Trigger()
Destructor.
void enableForInstance(Instance *instance)
Enables trigger for given instance.
Base class for all fife classes Used e.g.
void addTriggerCondition(TriggerCondition type)
Adds trigger condition.
void removeTriggerCondition(TriggerCondition type)
Removes trigger condition.
const std::vector< Cell * > & getAssignedCells()
Returns vector with the cells where the trigger is assigned to.
std::vector< ITriggerListener * > m_triggerListeners
Vector of the listeners that get called.
bool m_enabledAll
true if the trigger is enabled for all instances
void assign(Layer *layer, const ModelCoordinate &pt)
Assigns trigger on given layer and position.
const std::vector< TriggerCondition > & getTriggerConditions()
Returns trigger conditions in an vector.
A basic cell on a CellCache.
std::vector< Instance * > m_enabledInstances
all enabled instances
Instance * m_attached
instance where the trigger is attached to
Instance * getAttached()
Returns pointer to instance where the trigger is attached to.
void moveTo(const ModelCoordinate &newPos, const ModelCoordinate &oldPos)
Moves the trigger from the old position to the new position.
const std::vector< Instance * > & getEnabledInstances()
Returns instance which the trigger is enabled for.
void disableForAllInstances()
Disables trigger for all instances.
void reset()
Reset trigger.
std::vector< TriggerCondition > m_triggerConditions
all trigger conditions
Trigger()
Default constructor.
void removeTriggerListener(ITriggerListener *listener)
Removes a listener from the trigger.
Trigger get triggered when a specific set of criteria are met.
void disableForInstance(Instance *instance)
Disables trigger for given instance.
void enableForAllInstances()
Enables trigger for all instances.
bool m_triggered
true if this trigger has been triggered
virtual void onTriggered()=0
bool isTriggered()
Returns if the trigger has been triggered.
void addTriggerListener(ITriggerListener *listener)
Add a listener to the trigger.
An Instance is an "instantiation" of an Object at a Location.
bool isEnabledForAllInstances()
Returns if trigger is enabled for all instances.
void setTriggered()
Sets the trigger to triggered and calls ITriggerListener->onTriggered()
std::vector< Cell * > m_assigned
cells in which the trigger is assigned