diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-08-17 00:45:37 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-08-17 00:45:37 +0400 |
commit | fda00bc034de33371c4c7471467889f7d33c780b (patch) | |
tree | 4f239406f7bafb931d74ab11088f6239f3822eef /source/gameengine/Converter | |
parent | ae42934c935c654d4ec29c2156a8ebe212f3652e (diff) |
BGE patch: New Delay sensor (derived from patch #17472)
Introduction of a new Delay sensor that can be used to
generate positive and negative triggers at precise time,
expressed in number of frames.
The delay parameter defines the length of the initial
OFF period. A positive trigger is generated at the end
of this period. The duration parameter defines the
length of the ON period following the OFF period.
A negative trigger is generated at the end of the ON period.
If duration is 0, the sensor stays ON and there is no
negative trigger.
The sensor runs the OFF-ON cycle once unless the repeat
option is set: the OFF-ON cycle repeats indefinately
(or the OFF cycle if duration is 0).
The new generic SCA_ISensor::reset() Python function
can be used at any time to restart the sensor: the
current cycle is interrupted and no trigger is generated.
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertSensors.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index 76a12fb7f42..4806df36090 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -65,6 +65,7 @@ probably misplaced */ #include "SCA_JoystickSensor.h" #include "KX_NetworkMessageSensor.h" #include "SCA_ActuatorSensor.h" +#include "SCA_DelaySensor.h" #include "SCA_PropertySensor.h" @@ -281,6 +282,22 @@ void BL_ConvertSensors(struct Object* blenderobject, break; } + case SENS_DELAY: + { + // we can reuse the Always event manager for the delay sensor + SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::ALWAYS_EVENTMGR); + if (eventmgr) + { + bDelaySensor* delaysensor = (bDelaySensor*)sens->data; + gamesensor = new SCA_DelaySensor(eventmgr, + gameobj, + delaysensor->delay, + delaysensor->duration, + (delaysensor->flag & SENS_DELAY_REPEAT) != 0); + } + break; + } + case SENS_COLLISION: { SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR); |