From e43996bdc88784d8316fb17e7e6c1449c6330230 Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Thu, 27 Feb 2014 09:11:13 +0100 Subject: [PATCH] =?UTF-8?q?Se=20till=20s=C3=A5=20att=20man=20inte=20g?= =?UTF-8?q?=C3=A5r=20=C3=B6ver=20maxenergy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/Game/GameLogic/AttatchmentMassDriver.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index f4b5e2ec..401c40f8 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -105,6 +105,7 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, void AttatchmentMassDriver::Update(float dt) { + //update position of heldObject if there is an object being held if(hasObject) { @@ -116,12 +117,26 @@ void AttatchmentMassDriver::Update(float dt) heldObject->SetPosition(pos); heldObject->SetLinearVelocity(Oyster::Math::Float3::null); - currentEnergy += rechargeRate * 0.5f; //rechargeRate is halfed if you are holding an object + if(currentEnergy < maxEnergy) + { + currentEnergy += rechargeRate * 0.5f; //rechargeRate is halfed if you are holding an object + } + } else { - currentEnergy += rechargeRate; + if(currentEnergy < maxEnergy) + { + currentEnergy += rechargeRate; + + if(currentEnergy == maxEnergy) + { + int trap = 0; + } + } } + + if(currentEnergy > maxEnergy) currentEnergy = maxEnergy; }