Changeset 10634 in orxonox.OLD for branches/inputdevice/src/world_entities
- Timestamp:
- Apr 19, 2007, 11:45:56 AM (18 years ago)
- Location:
- branches/inputdevice/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/inputdevice/src/world_entities/player.cc
r10632 r10634 17 17 #include "playable.h" 18 18 #include "space_ships/space_ship.h" 19 #include "script_triggers/action_trigger.h"20 19 21 20 #include "event_handler.h" … … 41 40 42 41 this->subscribeEvent(ES_GAME, KeyMapper::PEV_CHANGE_SHIP); 43 this->subscribeEvent(ES_GAME, KeyMapper::PEV_ACTION);44 42 } 45 43 … … 134 132 this->enterNewPlayable(); 135 133 } 136 else if(event.type == KeyMapper::PEV_ACTION && event.bPressed)137 {138 for (ObjectList<ActionTrigger>::const_iterator it = ActionTrigger::objectList().begin();139 it != ActionTrigger::objectList().end();140 ++it)141 (*it)->executeAction();142 }143 134 144 135 if (likely(this->playable != NULL)) -
branches/inputdevice/src/world_entities/script_triggers/action_trigger.cc
r10632 r10634 17 17 #include "action_trigger.h" 18 18 #include "debug.h" 19 #include "event_handler.h" 19 20 20 21 ObjectListDefinition(ActionTrigger); … … 48 49 { 49 50 this->registerObject(this, ActionTrigger::_objectList); 51 this->subscribeEvent(ES_GAME, KeyMapper::PEV_ACTION); 50 52 51 53 radius = 10; … … 117 119 } 118 120 121 void ActionTrigger::process( const Event &event) 122 { 123 if (event.type == KeyMapper::PEV_ACTION && event.bPressed) 124 actionScheduled = true; 125 } 119 126 120 127 void ActionTrigger::tick( float timestep ) … … 128 135 executeScriptFunction(timestep); 129 136 scriptCalled = true; 130 return;131 137 } 132 138 else if( invert && this->distance(target) > radius && actionScheduled) … … 134 140 executeScriptFunction(timestep); 135 141 scriptCalled = true; 136 return;137 142 } 138 143 } -
branches/inputdevice/src/world_entities/script_triggers/action_trigger.h
r10631 r10634 12 12 #include "script_class.h" 13 13 #include "script_trigger.h" 14 #include "event_listener.h" 14 15 15 class ActionTrigger : public ScriptTrigger 16 class ActionTrigger : public ScriptTrigger, public EventListener 16 17 { 17 18 ObjectListDeclaration(ActionTrigger); … … 26 27 27 28 /// DO WORK 28 virtual void executeAction(){actionScheduled = true;}29 virtual void process( const Event &event); 29 30 virtual void tick(float timestep); 30 31 -
branches/inputdevice/src/world_entities/script_triggers/script_trigger.h
r10631 r10634 29 29 virtual void tick(float timestep){} 30 30 virtual void executeScriptFunction(float timestep); 31 void testScriptingFramework();32 31 33 32 /// SET MEMBER
Note: See TracChangeset
for help on using the changeset viewer.