Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-08-17 00:45:37 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-08-17 00:45:37 +0400
commitfda00bc034de33371c4c7471467889f7d33c780b (patch)
tree4f239406f7bafb931d74ab11088f6239f3822eef /source/gameengine/PyDoc
parentae42934c935c654d4ec29c2156a8ebe212f3652e (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/PyDoc')
-rw-r--r--source/gameengine/PyDoc/GameLogic.py1
-rw-r--r--source/gameengine/PyDoc/SCA_DelaySensor.py56
-rw-r--r--source/gameengine/PyDoc/SCA_ISensor.py6
3 files changed, 63 insertions, 0 deletions
diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py
index 965c0522bd7..c911ce8ec60 100644
--- a/source/gameengine/PyDoc/GameLogic.py
+++ b/source/gameengine/PyDoc/GameLogic.py
@@ -42,6 +42,7 @@ Documentation for the GameLogic Module.
- L{SCA_MouseSensor}
- L{SCA_PropertySensor}
- L{SCA_RandomSensor}
+ - L{SCA_DelaySensor}
You can also access actuators linked to the controller::
# To get an actuator attached to the controller:
diff --git a/source/gameengine/PyDoc/SCA_DelaySensor.py b/source/gameengine/PyDoc/SCA_DelaySensor.py
new file mode 100644
index 00000000000..46b74f461a7
--- /dev/null
+++ b/source/gameengine/PyDoc/SCA_DelaySensor.py
@@ -0,0 +1,56 @@
+# $Id$
+# Documentation for SCA_DelaySensor
+from SCA_IActuator import *
+
+class SCA_DelaySensor(SCA_ISensor):
+ """
+ The Delay sensor generates 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.
+ There is a negative trigger 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).
+ Use SCA_ISensor::reset() at any time to restart sensor.
+ """
+ def setDelay(delay):
+ """
+ Set the initial delay before the positive trigger.
+
+ @param delay: length of the initial OFF period as number of frame, 0 for immediate trigger
+ @type delay: integer
+ """
+ def setDuration(duration):
+ """
+ Set the duration of the ON pulse after initial delay and the generation of the positive trigger.
+ If duration is greater than 0, a negative trigger is sent at the end of the ON pulse.
+
+ @param duration: length of the ON period in number of frame after the initial OFF period
+ @type duration: integer
+ """
+ def setRepeat(repeat):
+ """
+ Set if the sensor repeat mode.
+
+ @param repeat: 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
+ @type repeat: integer
+ """
+ def getDelay():
+ """
+ Return the delay parameter value.
+
+ @rtype: integer
+ """
+ def getDuration():
+ """
+ Return the duration parameter value
+
+ @rtype: integer
+ """
+ def getRepeat():
+ """
+ Return the repeat parameter value
+
+ @rtype: KX_TRUE or KX_FALSE
+ """
diff --git a/source/gameengine/PyDoc/SCA_ISensor.py b/source/gameengine/PyDoc/SCA_ISensor.py
index 0ebc2debb31..33f0e976284 100644
--- a/source/gameengine/PyDoc/SCA_ISensor.py
+++ b/source/gameengine/PyDoc/SCA_ISensor.py
@@ -77,4 +77,10 @@ class SCA_ISensor(SCA_ILogicBrick):
@param level: Detect level instead of edge? (KX_TRUE, KX_FALSE)
@type level: boolean
"""
+ def reset():
+ """
+ Reset sensor internal state, effect depends on the type of sensor and settings.
+
+ The sensor is put in its initial state as if it was just activated.
+ """