Rev | Line | |
---|
[10630] | 1 | /*! |
---|
| 2 | * @file action_trigger.h |
---|
| 3 | * triggeres a script when a world_entity is in range and the player has pressed the action button |
---|
| 4 | */ |
---|
| 5 | |
---|
[10631] | 6 | #ifndef _ACTION_TRIGGER_H |
---|
| 7 | #define _ACTION_TRIGGER_H |
---|
[10630] | 8 | |
---|
| 9 | #include <string> |
---|
| 10 | |
---|
| 11 | #include "script.h" |
---|
| 12 | #include "script_class.h" |
---|
| 13 | #include "script_trigger.h" |
---|
| 14 | |
---|
| 15 | class ActionTrigger : public ScriptTrigger |
---|
| 16 | { |
---|
| 17 | ObjectListDeclaration(ActionTrigger); |
---|
| 18 | |
---|
| 19 | public: |
---|
| 20 | ActionTrigger(const TiXmlElement* root = NULL); |
---|
| 21 | ~ActionTrigger(); |
---|
| 22 | |
---|
| 23 | ///LOADING |
---|
| 24 | virtual void loadParams(const TiXmlElement* root); |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | /// DO WORK |
---|
[10631] | 28 | virtual void executeAction(){actionScheduled = true;} |
---|
[10630] | 29 | virtual void tick(float timestep); |
---|
| 30 | |
---|
| 31 | /// SET MEMBER |
---|
| 32 | void setTarget(const std::string& targetName); |
---|
| 33 | void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; } |
---|
| 34 | void setInvert(const bool inv) { this->invert = invert; } |
---|
| 35 | void setRadius(const float radius) { if(radius>0) this->radius = radius; } |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | private: |
---|
| 39 | bool actionScheduled; |
---|
| 40 | WorldEntity* target; |
---|
| 41 | bool invert; |
---|
| 42 | float radius; |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.