diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp
index e254b93b..80562b2c 100644
--- a/Code/Game/GameLogic/CollisionManager.cpp
+++ b/Code/Game/GameLogic/CollisionManager.cpp
@@ -8,7 +8,6 @@
#include "CollisionManager.h"
#include "JumpPad.h"
#include "Portal.h"
-#include "CrystalFormation.h"
#include "ExplosiveCrate.h"
using namespace Oyster;
@@ -47,7 +46,7 @@ using namespace GameLogic;
break;
case ObjectSpecialType::ObjectSpecialType_CrystalFormation:
- PlayerVLethalObject(*player,*realObj, kineticEnergyLoss,((CrystalFormation*)realObj)->getShreddingDamage());
+ PlayerVLethalObject(*player,*realObj, kineticEnergyLoss,realObj->getExtraDamageOnCollision());
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
break;
}
@@ -97,7 +96,6 @@ using namespace GameLogic;
int forceThreashHold = 200000; //how much force for the box to explode of the impact
-
if(kineticEnergyLoss > forceThreashHold)
{
ExplosiveCrate* crate = ((ExplosiveCrate*)rigidBodyCrate->GetCustomTag());
@@ -117,16 +115,19 @@ using namespace GameLogic;
Object *realObj = (Object*)obj->GetCustomTag();
ExplosiveCrate* ExplosionSource = ((ExplosiveCrate*)args);
-
+ Oyster::Math::Float3 explosionCenterPos = ExplosionSource->GetPosition();
+ Oyster::Math::Float3 hitObjectPos = obj->GetState().centerPos;
+ Oyster::Math::Float3 force = (((hitObjectPos- explosionCenterPos).GetNormalized()) * ExplosionSource->pushForceMagnitude);
+
if(realObj->GetObjectType() == ObjectSpecialType::ObjectSpecialType_Player)
{
Player *hitPlayer = (Player*)realObj;
- hitPlayer->DamageLife(ExplosionSource->shreddingDamage);
+ hitPlayer->DamageLife(ExplosionSource->getExtraDamageOnCollision());
//do shredding damage
}
- realObj->GetRigidBody()->ApplyImpulse(ExplosionSource->pushForce);
+ realObj->GetRigidBody()->ApplyImpulse(force);
}
diff --git a/Code/Game/GameLogic/CrystalFormation.cpp b/Code/Game/GameLogic/CrystalFormation.cpp
deleted file mode 100644
index e9c6dd73..00000000
--- a/Code/Game/GameLogic/CrystalFormation.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "CrystalFormation.h"
-
-using namespace GameLogic;
-
-CrystalFormation::CrystalFormation(void)
- :StaticObject()
-{
- this->shreddingDamage = 0;
-}
-
-CrystalFormation::CrystalFormation(Oyster::Physics::ICustomBody *rigidBody, int objectID,Oyster::Math::Float shreddingDamage)
- :StaticObject(rigidBody, CrystalFormation::DefaultCollisionAfter, ObjectSpecialType::ObjectSpecialType_CrystalFormation, objectID)
-{
- this->shreddingDamage = shreddingDamage;
-}
-
-
-CrystalFormation::~CrystalFormation(void)
-{
-}
-
-Oyster::Math::Float CrystalFormation::getShreddingDamage()
-{
- return this->shreddingDamage;
-}
diff --git a/Code/Game/GameLogic/CrystalFormation.h b/Code/Game/GameLogic/CrystalFormation.h
deleted file mode 100644
index 6e07942b..00000000
--- a/Code/Game/GameLogic/CrystalFormation.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef CRYSTALFORMATION_H
-#define CRYSTALFORMATION_H
-#include "StaticObject.h"
-namespace GameLogic
-{
- class CrystalFormation : public StaticObject
- {
- public:
- CrystalFormation(void);
-
- CrystalFormation(Oyster::Physics::ICustomBody *rigidBody
- ,int objectID,Oyster::Math::Float shreddingDamage);
-
- ~CrystalFormation(void);
-
- Oyster::Math::Float getShreddingDamage();
-
- private:
- Oyster::Math::Float shreddingDamage;
- };
-}
-#endif
\ No newline at end of file
diff --git a/Code/Game/GameLogic/ExplosiveCrate.cpp b/Code/Game/GameLogic/ExplosiveCrate.cpp
index 534fd6bb..d236d400 100644
--- a/Code/Game/GameLogic/ExplosiveCrate.cpp
+++ b/Code/Game/GameLogic/ExplosiveCrate.cpp
@@ -5,16 +5,15 @@ using namespace GameLogic;
ExplosiveCrate::ExplosiveCrate(void)
:DynamicObject()
{
- this->shreddingDamage = 0;
- this->pushForce = 0;
+ this->pushForceMagnitude = 0;
this->ExplosionRadius = 0;
}
-ExplosiveCrate::ExplosiveCrate(Oyster::Physics::ICustomBody *rigidBody,ObjectSpecialType type, int objectID,Oyster::Math::Float shreddingDamage, Oyster::Math::Float3 pushForce, Oyster::Math::Float ExplosionRadius)
+ExplosiveCrate::ExplosiveCrate(Oyster::Physics::ICustomBody *rigidBody,ObjectSpecialType type, int objectID,Oyster::Math::Float extraDamageOnCollision, Oyster::Math::Float pushForceMagnitude, Oyster::Math::Float ExplosionRadius)
:DynamicObject(rigidBody,ExplosiveCrate::ExplosiveCrateCollision, type, objectID)
{
- this->shreddingDamage = shreddingDamage;
- this->pushForce = pushForce;
+ this->extraDamageOnCollision = extraDamageOnCollision;
+ this->pushForceMagnitude = pushForceMagnitude;
this->ExplosionRadius = ExplosionRadius;
}
diff --git a/Code/Game/GameLogic/ExplosiveCrate.h b/Code/Game/GameLogic/ExplosiveCrate.h
index 3cf0c9a4..75afdc4a 100644
--- a/Code/Game/GameLogic/ExplosiveCrate.h
+++ b/Code/Game/GameLogic/ExplosiveCrate.h
@@ -8,7 +8,7 @@ namespace GameLogic
public:
ExplosiveCrate(void);
- ExplosiveCrate(Oyster::Physics::ICustomBody *rigidBody,ObjectSpecialType type,int objectID,Oyster::Math::Float shreddingDamage, Oyster::Math::Float3 pushForce, Oyster::Math::Float ExplosionRadius);
+ ExplosiveCrate(Oyster::Physics::ICustomBody *rigidBody,ObjectSpecialType type,int objectID,Oyster::Math::Float extraDamageOnCollision, Oyster::Math::Float pushForceMagnitude, Oyster::Math::Float ExplosionRadius);
~ExplosiveCrate(void);
@@ -16,9 +16,10 @@ namespace GameLogic
static void Explode(Oyster::Physics::ICustomBody *obj, void* args);
private:
- Oyster::Math::Float shreddingDamage;
- Oyster::Math::Float3 pushForce;
+ Oyster::Math::Float pushForceMagnitude;
Oyster::Math::Float ExplosionRadius;
};
+
+
}
#endif
\ No newline at end of file
diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj
index 48af6d60..6c026917 100644
--- a/Code/Game/GameLogic/GameLogic.vcxproj
+++ b/Code/Game/GameLogic/GameLogic.vcxproj
@@ -176,7 +176,6 @@
-
@@ -204,7 +203,6 @@
-
diff --git a/Code/Game/GameLogic/GameLogicStates.h b/Code/Game/GameLogic/GameLogicStates.h
index 3e9bcdf5..9ae0d482 100644
--- a/Code/Game/GameLogic/GameLogicStates.h
+++ b/Code/Game/GameLogic/GameLogicStates.h
@@ -43,12 +43,6 @@ namespace GameLogic
Oyster::Math::Float3 pushForce;
};
- struct ExplosionData
- {
- Oyster::Math::Float3 pushForce;
- Oyster::Math::Float3 ShreddingDamage;
- };
-
};
diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp
index cfd2d255..751dc454 100644
--- a/Code/Game/GameLogic/Object.cpp
+++ b/Code/Game/GameLogic/Object.cpp
@@ -28,6 +28,7 @@ Object::Object(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfte
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
this->type = type;
this->objectID = objectID;
+ this->extraDamageOnCollision = 0;
this->rigidBody->SetCustomTag(this);
}
@@ -38,6 +39,7 @@ Object::Object(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICusto
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
this->type = type;
this->objectID = objectID;
+ this->extraDamageOnCollision = 0;
this->rigidBody->SetCustomTag(this);
}
@@ -103,4 +105,10 @@ Oyster::Math::Float4x4 Object::GetOrientation()
Oyster::Physics::ICustomBody::State state;
state = this->rigidBody->GetState();
return state.GetOrientation();
+}
+
+
+Oyster::Math::Float Object::getExtraDamageOnCollision()
+{
+ return this->extraDamageOnCollision;
}
\ No newline at end of file
diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h
index 7e7e3f08..73853bd8 100644
--- a/Code/Game/GameLogic/Object.h
+++ b/Code/Game/GameLogic/Object.h
@@ -31,6 +31,8 @@ namespace GameLogic
Oyster::Math::Float3 GetScale() override;
Oyster::Math::Float4x4 GetOrientation() override;
+ Oyster::Math::Float getExtraDamageOnCollision();
+
// API overrides
@@ -58,6 +60,8 @@ namespace GameLogic
ObjectSpecialType type;
int objectID;
+
+ Oyster::Math::Float extraDamageOnCollision;
};
}