2013-11-26 09:19:59 +01:00
|
|
|
#include "CollisionManager.h"
|
2013-12-12 09:36:14 +01:00
|
|
|
#include "PhysicsAPI.h"
|
|
|
|
#include "Object.h"
|
|
|
|
#include "DynamicObject.h"
|
|
|
|
#include "Player.h"
|
2013-11-26 09:19:59 +01:00
|
|
|
|
2013-12-03 11:47:04 +01:00
|
|
|
using namespace Oyster;
|
2013-11-26 09:19:59 +01:00
|
|
|
|
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-12-12 12:16:13 +01:00
|
|
|
void PlayerVBox(Player &player, DynamicObject &box);
|
|
|
|
|
|
|
|
|
2013-12-03 11:47:04 +01:00
|
|
|
Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
2013-11-28 11:23:11 +01:00
|
|
|
{
|
2013-12-12 12:16:13 +01:00
|
|
|
Player *player = ((Player*)(rigidBodyPlayer->gameObjectRef));
|
|
|
|
Object *realObj = (Object*)obj->gameObjectRef;
|
2013-11-28 11:23:11 +01:00
|
|
|
|
|
|
|
switch (realObj->GetType())
|
|
|
|
{
|
2013-12-12 09:36:14 +01:00
|
|
|
case OBJECT_TYPE_BOX:
|
2013-12-12 12:16:13 +01:00
|
|
|
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
2013-11-28 11:23:11 +01:00
|
|
|
break;
|
2013-12-12 09:36:14 +01:00
|
|
|
case OBJECT_TYPE_PLAYER:
|
2013-11-28 11:23:11 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-12-03 11:47:04 +01:00
|
|
|
return Physics::ICustomBody::SubscriptMessage_none;
|
2013-11-28 11:23:11 +01:00
|
|
|
}
|
|
|
|
|
2013-12-12 12:16:13 +01:00
|
|
|
void PlayerVBox(Player &player, DynamicObject &box)
|
2013-11-28 09:26:29 +01:00
|
|
|
{
|
2013-12-12 12:16:13 +01:00
|
|
|
player.DamageLife(20);
|
|
|
|
}
|
2013-11-28 11:23:11 +01:00
|
|
|
|
2013-12-03 11:47:04 +01:00
|
|
|
Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
|
2013-11-28 11:23:11 +01:00
|
|
|
{
|
2013-12-12 12:16:13 +01:00
|
|
|
DynamicObject *box = (DynamicObject*)rigidBodyBox->gameObjectRef;
|
|
|
|
Object *realObj = (Object*)obj->gameObjectRef;
|
2013-11-28 11:23:11 +01:00
|
|
|
|
|
|
|
switch (realObj->GetType())
|
|
|
|
{
|
2013-12-12 09:36:14 +01:00
|
|
|
case OBJECT_TYPE_BOX:
|
2013-11-28 11:23:11 +01:00
|
|
|
|
|
|
|
break;
|
2013-12-12 09:36:14 +01:00
|
|
|
case OBJECT_TYPE_PLAYER:
|
|
|
|
//PlayerVBox(*(Player*)realObj,*box);
|
2013-11-28 11:23:11 +01:00
|
|
|
break;
|
|
|
|
}
|
2013-12-03 11:47:04 +01:00
|
|
|
|
|
|
|
return Physics::ICustomBody::SubscriptMessage_none;
|
2013-11-28 11:23:11 +01:00
|
|
|
}
|
2013-11-28 09:26:29 +01:00
|
|
|
}
|
2013-11-26 11:30:49 +01:00
|
|
|
}
|