iPcTrigger Struct Reference
This is a trigger property class. More...
#include <propclass/trigger.h>
Public Member Functions | |
virtual void | AddTriggerListener (iPcTriggerListener *listener)=0 |
Add a trigger listener. | |
virtual void | RemoveTriggerListener (iPcTriggerListener *listener)=0 |
Remove a trigger listener. | |
virtual void | SetupTriggerSphere (iSector *sector, const csVector3 ¢er, float radius)=0 |
Setup a spherical area as trigger zone. | |
virtual void | SetupTriggerSphere (iSector *sector, const char *center_name, float radius)=0 |
Setup a spherical area as trigger zone. | |
virtual void | SetupTriggerBox (iSector *sector, const csBox3 &box)=0 |
Setup a box trigger zone. | |
virtual void | SetupTriggerAboveMesh (iPcMesh *mesh, float maxdistance)=0 |
Setup a trigger to fire if this mesh ends up above another mesh. | |
virtual void | MonitorEntity (const char *entityname)=0 |
By default pctrigger will monitor all entities. | |
virtual const char * | GetMonitorEntity () const =0 |
Return the entity name that we are currently monitoring or 0 if monitoring all entities. | |
virtual void | SetMonitorDelay (csTicks delay, csTicks jitter)=0 |
Set the number of milliseconds we delay before monitoring all entities again. | |
virtual void | EnableMessagesToSelf (bool en)=0 |
Enable/disable sending messages to the entity containing the trigger about other entities leaving of entering (messages like pctrigger_entityenters and pctrigger_entityleaves). | |
virtual void | EnableMessagesToOthers (bool en)=0 |
Enable/disable sending messages to the entities that enter or leave this trigger (messages like pctrigger_entertrigger and pctrigger_leavetrigger). | |
virtual void | EnableTrigger (bool en)=0 |
Disable trigger. | |
virtual bool | IsEnabled () const =0 |
Return true if trigger is enabled. | |
virtual const csWeakRefArray< iCelEntity > & | GetEntitiesInTrigger () const =0 |
Get an array of all entities that are currently in the trigger area. | |
virtual bool | Check ()=0 |
This only works if we are monitoring an individual entity. |
Detailed Description
This is a trigger property class.It is capable of detecting when another entity (that has a pcmesh) enters or leaves an area defined by this trigger. In that case it can send messages to the entity that contains this property class and/or the entities that enter/leave the trigger area.
This property class supports the following actions (add prefix 'cel.action.' to get the ID of the action and add prefix 'cel.parameter.' to get the ID of the parameter):
- SetupTriggerSphere: parameters 'sector' (string), 'position' (vector3 or string (name of mapnode in that case)), and 'radius' (float).
- SetupTriggerBox: parameters 'sector' (string), 'minbox' (vector3), and 'maxbox' (vector3).
- SetupTriggerAboveMesh: parameters 'entity' (string) and 'maxdistance' (float),
This property class can send out the following messages to the behaviour (add prefix 'cel.parameter.' to get the ID for parameters):
- pctrigger_entityenters: an entity enters this trigger (entity).
- pctrigger_entityleaves: an entity leaves this trigger (entity).
- pctrigger_entertrigger: this entity enters a trigger (entity).
- pctrigger_leavetrigger: this entity leaves a trigger (entity).
This property class supports the following properties (add prefix 'cel.property.' to get the ID of the property:
- delay (long, read/write): update delay for checking trigger.
- jitter (long, read/write): random jitter added to update delay.
- monitor (string, read/write): name of entity to monitor.
Definition at line 100 of file trigger.h.
Member Function Documentation
|
Add a trigger listener. Trigger listeners are called right before the behaviour is called. |
|
This only works if we are monitoring an individual entity. In that case it will return true if the entity is already in the trigger. |
|
Enable/disable sending messages to the entities that enter or leave this trigger (messages like pctrigger_entertrigger and pctrigger_leavetrigger). This is enabled by default. |
|
Enable/disable sending messages to the entity containing the trigger about other entities leaving of entering (messages like pctrigger_entityenters and pctrigger_entityleaves). This is enabled by default. |
|
Disable trigger. Triggers are enabled by default. |
|
Get an array of all entities that are currently in the trigger area.
|
|
Return the entity name that we are currently monitoring or 0 if monitoring all entities.
|
|
Return true if trigger is enabled.
|
|
By default pctrigger will monitor all entities. If you only want pctrigger to monitor one entity then you can give the name of that entity here. pctrigger will try to find the entity with that name and monitor it. To go back to monitoring all entities just call this function with a 0 name. |
|
Remove a trigger listener.
|
|
Set the number of milliseconds we delay before monitoring all entities again. There is also a jitter parameter which will add a small random amount to that time to prevent all triggers trying to do the monitoring at once. By default this is set to 200/20 (i.e. roughly five times per second). |
|
Setup a trigger to fire if this mesh ends up above another mesh. This works by tracing a beam down from the center of the mesh. |
|
Setup a box trigger zone.
|
|
Setup a spherical area as trigger zone. This version uses a mapnode (<node> in XML) in the sector to get the position from. |
|
Setup a spherical area as trigger zone.
|
The documentation for this struct was generated from the following file:
- propclass/trigger.h
Generated for CEL: Crystal Entity Layer by doxygen 1.4.4