diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 11:24:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 11:24:04 +0400 |
commit | 55d2b184ec1b2c1adfe182ead937cedae1a8208d (patch) | |
tree | 580d5d4efa458f2e834708bac799902b6c5e997f /source/gameengine/GameLogic/SCA_PropertyActuator.cpp | |
parent | 33170295c8a2f3eb815b6086f47147113fd3de13 (diff) |
added "toggle" an option for the property actuator.
much less hassle then setting up a property sensor and 2 assignment actuators, or through python.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PropertyActuator.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertyActuator.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index 444c616870d..37df8a5c401 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -135,6 +135,23 @@ bool SCA_PropertyActuator::Update() } break; } + case KX_ACT_PROP_TOGGLE: + { + + CValue* newval; + CValue* oldprop = propowner->GetProperty(m_propname); + if (oldprop) + { + newval = new CBoolValue((oldprop->GetNumber()==0.0) ? true:false); + oldprop->SetValue(newval); + } else + { /* as not been assigned, evaluate as false, so assign true */ + newval = new CBoolValue(true); + propowner->SetProperty(m_propname,newval); + } + newval->Release(); + break; + } default: { |