diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-08-23 15:54:27 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-08-23 15:54:27 +0400 |
commit | bc8f002a4c68235db766fbd72bc383feb7836341 (patch) | |
tree | c56be248aa873c07af07f85061e4aa4f3bf8a3f4 /source/gameengine/GameLogic/SCA_LogicManager.h | |
parent | 2076703a286a61b175441a0413f348b0596e1964 (diff) |
BGE state system improvement: the sensor with Level option enabled will trigger the controller of a newly activated state, even if the sensor is already connected to an active state; new isTriggered() python function to determine which sensor triggered the current controller.
Previously, this behaviour was available only for sensors
that were not connected to any active state, which was
forcing the game designer to duplicate sensors in some
cases.
For example the Always sensors used to initialize the
states needed to be duplicated for each state. With this
patch, a single Always sensor with Level option enabled
will suffice to initialize all the states.
A Python controller can determine which sensor did trigger
with the new SCA_ISensor::isTriggered() function.
Notes:
- When a sensor with level option enabled is connected
to multiple controllers, only those of newly activated
states will be triggered. The controllers of already
activated states will receive no trigger, unless the
sensor internal state toggled, in which case all the
controllers are triggered as always.
- The old isPositive() function returns the internal
state of the sensor, positive or negative; the new
isTriggered() function returns 1 only for sensors
that generated an event in the current frame.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_LogicManager.h')
-rw-r--r-- | source/gameengine/GameLogic/SCA_LogicManager.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h index e0d3d506702..50383879d8f 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.h +++ b/source/gameengine/GameLogic/SCA_LogicManager.h @@ -99,6 +99,7 @@ class SCA_LogicManager vector<class SCA_ISensor*> m_activatedsensors; set<class SmartActuatorPtr> m_activeActuators; + set<class SmartControllerPtr> m_triggeredControllerSet; map<SCA_ISensor*,controllerlist > m_sensorcontrollermapje; @@ -127,6 +128,7 @@ public: void EndFrame(); void AddActivatedSensor(SCA_ISensor* sensor); void AddActiveActuator(SCA_IActuator* sensor,class CValue* event); + void AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor); SCA_EventManager* FindEventManager(int eventmgrtype); void RemoveGameObject(const STR_String& gameobjname); |