/*! * @file action_trigger.h * triggeres a script when a world_entity is in range and the player has pressed the action button */ #ifndef _ACTION_TRIGGER_H #define _ACTION_TRIGGER_H #include #include "script.h" #include "script_class.h" #include "script_trigger.h" class ActionTrigger : public ScriptTrigger { ObjectListDeclaration(ActionTrigger); public: ActionTrigger(const TiXmlElement* root = NULL); ~ActionTrigger(); ///LOADING virtual void loadParams(const TiXmlElement* root); /// DO WORK virtual void executeAction(){actionScheduled = true;} virtual void tick(float timestep); /// SET MEMBER void setTarget(const std::string& targetName); void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; } void setInvert(const bool inv) { this->invert = invert; } void setRadius(const float radius) { if(radius>0) this->radius = radius; } private: bool actionScheduled; WorldEntity* target; bool invert; float radius; }; #endif