2013-12-12 09:36:14 +01:00
|
|
|
#include "PhysicsAPI.h"
|
|
|
|
#include "Object.h"
|
|
|
|
#include "DynamicObject.h"
|
|
|
|
#include "Player.h"
|
2014-01-21 15:46:54 +01:00
|
|
|
#include "Level.h"
|
2014-01-22 14:26:45 +01:00
|
|
|
#include "AttatchmentMassDriver.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-12-19 10:21:03 +01:00
|
|
|
using namespace GameLogic;
|
2013-11-28 09:26:29 +01:00
|
|
|
|
2013-12-19 10:21:03 +01:00
|
|
|
void PlayerVBox(Player &player, DynamicObject &box);
|
2014-01-21 15:46:54 +01:00
|
|
|
void PlayerVObject(Player &player, Object &obj);
|
2013-11-28 11:23:11 +01:00
|
|
|
|
2013-12-12 12:16:13 +01:00
|
|
|
|
2014-01-21 15:46:54 +01:00
|
|
|
Physics::ICustomBody::SubscriptMessage Player::PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
2013-12-19 10:21:03 +01:00
|
|
|
{
|
2014-01-21 15:46:54 +01:00
|
|
|
Player *player = ((Player*)(rigidBodyPlayer->GetCustomTag()));
|
|
|
|
Object *realObj = (Object*)obj->GetCustomTag();
|
|
|
|
|
|
|
|
switch (realObj->GetType())
|
|
|
|
{
|
|
|
|
case OBJECT_H::OBJECT_TYPE_GENERIC:
|
|
|
|
PlayerVObject(*player,*realObj);
|
|
|
|
Physics::ICustomBody::SubscriptMessage_none;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TYPE::OBJECT_TYPE_BOX:
|
|
|
|
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
|
|
|
Physics::ICustomBody::SubscriptMessage_none;
|
|
|
|
break;
|
|
|
|
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
|
|
|
|
Physics::ICustomBody::SubscriptMessage_none;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
2013-12-19 10:21:03 +01:00
|
|
|
|
|
|
|
return Physics::ICustomBody::SubscriptMessage_none;
|
|
|
|
}
|
2013-11-28 11:23:11 +01:00
|
|
|
|
2013-12-19 10:21:03 +01:00
|
|
|
void PlayerVBox(Player &player, DynamicObject &box)
|
|
|
|
{
|
2014-01-21 15:46:54 +01:00
|
|
|
//use kinetic energyloss of the collision in order too determin how much damage to take
|
|
|
|
//use as part of the damage algorithm
|
2013-12-19 10:21:03 +01:00
|
|
|
player.DamageLife(20);
|
|
|
|
}
|
|
|
|
|
2014-01-21 15:46:54 +01:00
|
|
|
void PlayerVObject(Player &player, Object &obj)
|
|
|
|
{
|
|
|
|
//Collision between a player and a general static or dynamic object
|
|
|
|
//use kinetic energyloss of the collision in order too determin how much damage to take
|
|
|
|
//use as part of the damage algorithm
|
|
|
|
player.DamageLife(20);
|
2013-11-28 09:26:29 +01:00
|
|
|
}
|
2014-01-21 15:46:54 +01:00
|
|
|
|
2014-01-16 11:40:29 +01:00
|
|
|
|
2014-01-21 15:46:54 +01:00
|
|
|
Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollision(const Oyster::Physics::ICustomBody *rigidBodyLevel, const Oyster::Physics::ICustomBody *obj)
|
2014-01-16 11:40:29 +01:00
|
|
|
{
|
|
|
|
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
|
|
|
}
|
2014-01-22 14:26:45 +01:00
|
|
|
|
|
|
|
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj)
|
2014-01-22 14:39:10 +01:00
|
|
|
{
|
|
|
|
Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500);
|
|
|
|
((Object*)obj->GetCustomTag())->ApplyLinearImpulse(pushForce);
|
|
|
|
}
|