2013-11-26 09:19:59 +01:00
|
|
|
#include "CollisionManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
namespace GameLogic
|
2013-11-26 09:19:59 +01:00
|
|
|
{
|
2013-11-28 09:26:29 +01:00
|
|
|
|
|
|
|
namespace CollisionManager
|
2013-11-26 11:30:49 +01:00
|
|
|
{
|
2013-11-28 11:23:11 +01:00
|
|
|
|
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
|
2013-11-26 11:30:49 +01:00
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
void ColisionEvent(Oyster::Physics::ICustomBody &obj1, Oyster::Physics::ICustomBody &obj2)
|
2013-11-26 11:30:49 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
//Object *realObj1 = refManager.GetMap(obj1);
|
|
|
|
//Object *realObj2 = refManager.GetMap(obj2);
|
|
|
|
//
|
|
|
|
//switch(realObj1->GetType())
|
|
|
|
//{
|
|
|
|
//case Object::OBJECT_TYPE_PLAYER:
|
2013-11-26 11:30:49 +01:00
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
// if (realObj2->GetType() == Object::OBJECT_TYPE_BOX )
|
|
|
|
// {
|
|
|
|
//CollisionManager::PlayerVBox(*((Player*)realObj1),*((DynamicObject*)realObj2));
|
|
|
|
// }
|
2013-11-26 11:30:49 +01:00
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
// break;
|
|
|
|
//case Object::OBJECT_TYPE_BOX:
|
2013-11-26 11:30:49 +01:00
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
// if (realObj2->GetType() == Object::OBJECT_TYPE_PLAYER)
|
|
|
|
// {
|
|
|
|
// CollisionManager::PlayerVBox(*((Player*)realObj2),*((DynamicObject*)realObj1));
|
|
|
|
// }
|
|
|
|
|
|
|
|
// break;
|
|
|
|
//}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-11-28 11:23:11 +01:00
|
|
|
void PlayerCollision(Oyster::Physics::ICustomBody &rigidBodyPlayer,Oyster::Physics::ICustomBody &obj)
|
|
|
|
{
|
|
|
|
Player *player = ((Player*)GameLogic::RefManager::getInstance()->GetMap(rigidBodyPlayer));
|
|
|
|
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(obj);
|
|
|
|
|
|
|
|
switch (realObj->GetType())
|
|
|
|
{
|
|
|
|
case Object::OBJECT_TYPE_BOX:
|
|
|
|
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
|
|
|
break;
|
|
|
|
case Object::OBJECT_TYPE_PLAYER:
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//spela ljud? ta skada? etc etc
|
|
|
|
}
|
|
|
|
|
2013-11-28 09:26:29 +01:00
|
|
|
void PlayerVBox(Player &player, DynamicObject &box)
|
|
|
|
{
|
|
|
|
//spela ljud? ta skada? etc etc
|
|
|
|
}
|
2013-11-28 11:23:11 +01:00
|
|
|
|
|
|
|
void BoxCollision(Oyster::Physics::ICustomBody &rigidBodyBox, Oyster::Physics::ICustomBody &obj)
|
|
|
|
{
|
|
|
|
DynamicObject *box = ((DynamicObject*)GameLogic::RefManager::getInstance()->GetMap(rigidBodyBox));
|
|
|
|
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(obj);
|
|
|
|
|
|
|
|
switch (realObj->GetType())
|
|
|
|
{
|
|
|
|
case Object::OBJECT_TYPE_BOX:
|
|
|
|
|
|
|
|
break;
|
|
|
|
case Object::OBJECT_TYPE_PLAYER:
|
|
|
|
PlayerVBox(*(Player*)realObj,*box);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-11-28 09:26:29 +01:00
|
|
|
}
|
2013-11-26 11:30:49 +01:00
|
|
|
}
|