GL - second draft damage

This commit is contained in:
Erik Persson 2014-02-21 11:56:48 +01:00
parent 0ceab1640d
commit a4a531264f
1 changed files with 12 additions and 2 deletions

View File

@ -181,13 +181,23 @@ using namespace GameLogic;
Oyster::Math::Float angularFactor = deltaPos.GetNormalized().Dot( (objPrevVel - playerPrevVel).GetNormalized()); Oyster::Math::Float angularFactor = deltaPos.GetNormalized().Dot( (objPrevVel - playerPrevVel).GetNormalized());
Oyster::Math::Float impactPower = deltaSpeed * angularFactor; Oyster::Math::Float impactPower = deltaSpeed * angularFactor;
Oyster::Math::Float damageFactor = 0.1f;
int damageDone = 0; int damageDone = 0;
int forceThreashHold = 200000; //FIX: balance this int forceThreashHold = 100; //FIX: balance this
if(impactPower > forceThreashHold) //should only take damage if the force is high enough if(impactPower > forceThreashHold) //should only take damage if the force is high enough
{ {
damageDone = (int)(kineticEnergyLoss * 0.10f); if(obj.GetRigidBody()->GetState().mass == 0)
{
damageDone = impactPower * damageFactor;
}
else
{
damageDone = (impactPower * obj.GetRigidBody()->GetState().mass)* damageFactor;
}
//player.DamageLife(damageDone); //player.DamageLife(damageDone);
} }