Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/inputdevice/src/world_entities/script_triggers/action_trigger.h @ 10631

Last change on this file since 10631 was 10631, checked in by snellen, 17 years ago

Action Trigger finished

File size: 1.1 KB
Line 
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
6#ifndef _ACTION_TRIGGER_H
7#define _ACTION_TRIGGER_H
8
9#include <string>
10
11#include "script.h"
12#include "script_class.h"
13#include "script_trigger.h"
14
15class 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
28    virtual void executeAction(){actionScheduled = true;}
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.