diff options
author | HG1 <HG1_public@gmx.net> | 2014-07-18 09:27:58 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-18 09:49:40 +0400 |
commit | 12a0cccfbf188425153514b3b821198cae558992 (patch) | |
tree | 6f0e180196cf4976866093e8d684e9ee926bea9e /source/gameengine/GameLogic/SCA_PropertyActuator.cpp | |
parent | a04a8039f0880cd35f92853460eefd066d3d8ef8 (diff) |
BGE: Add level mode to property actuator
This patch adds to the existing property actuator a level mode, which is switching the property depending on the input level.
Reviewers: moguri
Reviewed By: moguri
Differential Revision: https://developer.blender.org/D652
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PropertyActuator.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertyActuator.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index 0eab6187d07..ea1b2a2bce3 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -69,13 +69,24 @@ bool SCA_PropertyActuator::Update() bool bNegativeEvent = IsNegativeEvent(); RemoveAllEvents(); - + CValue* propowner = GetParent(); if (bNegativeEvent) - return false; // do nothing on negative events + { + if (m_type==KX_ACT_PROP_LEVEL) + { + CValue* newval = new CBoolValue(false); + CValue* oldprop = propowner->GetProperty(m_propname); + if (oldprop) + { + oldprop->SetValue(newval); + } + newval->Release(); + } + return false; + } - CValue* propowner = GetParent(); CParser parser; parser.SetContext( propowner->AddRef()); @@ -97,6 +108,19 @@ bool SCA_PropertyActuator::Update() } newval->Release(); } + else if (m_type==KX_ACT_PROP_LEVEL) + { + CValue* newval = new CBoolValue(true); + CValue* oldprop = propowner->GetProperty(m_propname); + if (oldprop) + { + oldprop->SetValue(newval); + } else + { + propowner->SetProperty(m_propname,newval); + } + newval->Release(); + } else if ((userexpr = parser.ProcessText(m_exprtxt))) { switch (m_type) { |