Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 19, 2007, 11:45:56 AM (18 years ago)
Author:
snellen
Message:

Got nothing to do during the MTU lecture… so I finished the ActionTrigger

Location:
branches/inputdevice/src/world_entities/script_triggers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/inputdevice/src/world_entities/script_triggers/action_trigger.cc

    r10632 r10634  
    1717#include "action_trigger.h"
    1818#include "debug.h"
     19#include "event_handler.h"
    1920
    2021ObjectListDefinition(ActionTrigger);
     
    4849{
    4950  this->registerObject(this, ActionTrigger::_objectList);
     51  this->subscribeEvent(ES_GAME, KeyMapper::PEV_ACTION);
    5052
    5153  radius = 10;
     
    117119}
    118120
     121void ActionTrigger::process( const Event &event)
     122{
     123 if (event.type == KeyMapper::PEV_ACTION && event.bPressed)
     124  actionScheduled = true;
     125}
    119126
    120127void ActionTrigger::tick( float timestep )
     
    128135      executeScriptFunction(timestep);
    129136      scriptCalled = true;
    130       return;
    131137    }
    132138    else if( invert && this->distance(target) > radius  && actionScheduled)
     
    134140      executeScriptFunction(timestep);
    135141      scriptCalled = true;
    136       return;
    137142    }
    138143  }
  • branches/inputdevice/src/world_entities/script_triggers/action_trigger.h

    r10631 r10634  
    1212#include "script_class.h"
    1313#include "script_trigger.h"
     14#include "event_listener.h"
    1415
    15 class ActionTrigger : public ScriptTrigger
     16class ActionTrigger : public ScriptTrigger, public EventListener
    1617{
    1718  ObjectListDeclaration(ActionTrigger);
     
    2627
    2728    /// DO WORK
    28     virtual void executeAction(){actionScheduled = true;}
     29    virtual void process( const Event &event);
    2930    virtual void tick(float timestep);
    3031
  • branches/inputdevice/src/world_entities/script_triggers/script_trigger.h

    r10631 r10634  
    2929    virtual void tick(float timestep){}
    3030    virtual void executeScriptFunction(float timestep);
    31     void testScriptingFramework();
    3231
    3332    /// SET MEMBER
Note: See TracChangeset for help on using the changeset viewer.