Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic

This commit is contained in:
lindaandersson 2014-02-14 11:07:11 +01:00
commit 9038277a2c
12 changed files with 30 additions and 74 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -176,7 +176,6 @@
<ClInclude Include="AttatchmentMassDriver.h" />
<ClInclude Include="AttatchmentSocket.h" />
<ClInclude Include="CollisionManager.h" />
<ClInclude Include="CrystalFormation.h" />
<ClInclude Include="DynamicObject.h" />
<ClInclude Include="ExplosiveCrate.h" />
<ClInclude Include="Game.h" />
@ -204,7 +203,6 @@
<ClCompile Include="AttatchmentMassDriver.cpp" />
<ClCompile Include="AttatchmentSocket.cpp" />
<ClCompile Include="CollisionManager.cpp" />
<ClCompile Include="CrystalFormation.cpp" />
<ClCompile Include="DynamicObject.cpp" />
<ClCompile Include="ExplosiveCrate.cpp" />
<ClCompile Include="Game.cpp" />

View File

@ -43,12 +43,6 @@ namespace GameLogic
Oyster::Math::Float3 pushForce;
};
struct ExplosionData
{
Oyster::Math::Float3 pushForce;
Oyster::Math::Float3 ShreddingDamage;
};
};

View File

@ -2,7 +2,6 @@
#include "CollisionManager.h"
#include "Game.h"
#include "JumpPad.h"
#include "CrystalFormation.h"
#include "ExplosiveCrate.h"
#include "Portal.h"
using namespace GameLogic;

View File

@ -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);
}
@ -104,3 +106,9 @@ Oyster::Math::Float4x4 Object::GetOrientation()
state = this->rigidBody->GetState();
return state.GetOrientation();
}
Oyster::Math::Float Object::getExtraDamageOnCollision()
{
return this->extraDamageOnCollision;
}

View File

@ -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;
};
}

View File

@ -10,8 +10,8 @@ Portal::Portal(void)
}
Portal::Portal(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type,int objectID ,Oyster::Math::Float3 portalExit)
:StaticObject(rigidBody, EventOnCollision, type, objectID)
Portal::Portal(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type,int objectID ,Oyster::Math::Float3 portalExit)
:StaticObject(rigidBody, Portal::PortalActivated, type, objectID)
{
this->portalExit = portalExit;
}

View File

@ -9,7 +9,6 @@ namespace GameLogic
Portal(void);
Portal(Oyster::Physics::ICustomBody *rigidBody
,void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)
,ObjectSpecialType type,int objectID ,Oyster::Math::Float3 portalExit);
~Portal(void);