Danbias/Code/Game/GameLogic/CollisionManager.cpp

58 lines
1.5 KiB
C++
Raw Normal View History

#include "CollisionManager.h"
#include "PhysicsAPI.h"
#include "Object.h"
#include "DynamicObject.h"
#include "Player.h"
using namespace Oyster;
2013-12-19 10:21:03 +01:00
using namespace GameLogic;
2013-12-19 10:21:03 +01:00
void PlayerVBox(Player &player, DynamicObject &box);
2013-12-19 10:21:03 +01:00
Physics::ICustomBody::SubscriptMessage CollisionManager::PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
{
Player *player = ((Player*)(rigidBodyPlayer->gameObjectRef));
Object *realObj = (Object*)obj->gameObjectRef;
2013-12-19 10:21:03 +01:00
switch (realObj->GetType().value)
{
2013-12-19 10:21:03 +01:00
case OBJECT_TYPE::OBJECT_TYPE_BOX:
PlayerVBox(*player,(*(DynamicObject*) realObj));
break;
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
2013-12-19 10:21:03 +01:00
break;
}
2013-12-19 10:21:03 +01:00
return Physics::ICustomBody::SubscriptMessage_none;
}
2013-12-19 10:21:03 +01:00
void PlayerVBox(Player &player, DynamicObject &box)
{
player.DamageLife(20);
}
2013-12-19 10:21:03 +01:00
Physics::ICustomBody::SubscriptMessage CollisionManager::BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
{
if(rigidBodyBox == 0)
{
2013-12-19 10:21:03 +01:00
return Physics::ICustomBody::SubscriptMessage::SubscriptMessage_none;
}
DynamicObject *box = (DynamicObject*)rigidBodyBox->gameObjectRef;
Object *realObj = (Object*)obj->gameObjectRef;
2013-12-19 10:21:03 +01:00
switch (realObj->GetType().value)
{
case OBJECT_TYPE::OBJECT_TYPE_BOX:
2013-12-19 10:21:03 +01:00
break;
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
//PlayerVBox(*(Player*)realObj,*box);
break;
}
2013-12-19 10:21:03 +01:00
return Physics::ICustomBody::SubscriptMessage_none;
}