GL - adjusting collisionManager
This commit is contained in:
parent
467cf1eb68
commit
6a888cb154
|
@ -9,11 +9,11 @@ using namespace Oyster;
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box);
|
void PlayerVBox(Player &player, DynamicObject &box, Oyster::Math::Float kineticEnergyLoss);
|
||||||
void PlayerVObject(Player &player, Object &obj);
|
void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss);
|
||||||
|
|
||||||
|
//Physics::ICustomBody::SubscriptMessage
|
||||||
Physics::ICustomBody::SubscriptMessage Player::PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
void Player::PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
{
|
{
|
||||||
Player *player = ((Player*)(rigidBodyPlayer->GetCustomTag()));
|
Player *player = ((Player*)(rigidBodyPlayer->GetCustomTag()));
|
||||||
Object *realObj = (Object*)obj->GetCustomTag();
|
Object *realObj = (Object*)obj->GetCustomTag();
|
||||||
|
@ -21,31 +21,30 @@ using namespace GameLogic;
|
||||||
switch (realObj->GetType())
|
switch (realObj->GetType())
|
||||||
{
|
{
|
||||||
case OBJECT_H::OBJECT_TYPE_GENERIC:
|
case OBJECT_H::OBJECT_TYPE_GENERIC:
|
||||||
PlayerVObject(*player,*realObj);
|
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
||||||
Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OBJECT_TYPE::OBJECT_TYPE_BOX:
|
case OBJECT_TYPE::OBJECT_TYPE_BOX:
|
||||||
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
PlayerVBox(*player,(*(DynamicObject*) realObj), kineticEnergyLoss);
|
||||||
Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
|
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
|
||||||
Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box)
|
void PlayerVBox(Player &player, DynamicObject &box, Oyster::Math::Float kineticEnergyLoss)
|
||||||
{
|
{
|
||||||
//use kinetic energyloss of the collision in order too determin how much damage to take
|
//use kinetic energyloss of the collision in order too determin how much damage to take
|
||||||
//use as part of the damage algorithm
|
//use as part of the damage algorithm
|
||||||
player.DamageLife(20);
|
player.DamageLife(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerVObject(Player &player, Object &obj)
|
void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
{
|
{
|
||||||
//Collision between a player and a general static or dynamic object
|
//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 kinetic energyloss of the collision in order too determin how much damage to take
|
||||||
|
@ -53,10 +52,10 @@ using namespace GameLogic;
|
||||||
player.DamageLife(20);
|
player.DamageLife(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Oyster::Physics::ICustomBody::SubscriptMessage
|
||||||
Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollision(const Oyster::Physics::ICustomBody *rigidBodyLevel, const Oyster::Physics::ICustomBody *obj)
|
void Level::LevelCollision(const Oyster::Physics::ICustomBody *rigidBodyLevel, const Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
{
|
{
|
||||||
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
//return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj)
|
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj)
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Level::InitiateLevel(float radius)
|
||||||
sbDesc.radius = 8; //radius;
|
sbDesc.radius = 8; //radius;
|
||||||
sbDesc.mass = 10e12f;
|
sbDesc.mass = 10e12f;
|
||||||
//sbDesc.mass = 0; //10^16
|
//sbDesc.mass = 0; //10^16
|
||||||
sbDesc.subscription_onCollision = CollisionManager::LevelCollision;
|
sbDesc.subscription_onCollisionResponse = Level::LevelCollision;
|
||||||
|
|
||||||
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
API::Instance().AddObject(rigidBody);
|
API::Instance().AddObject(rigidBody);
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace GameLogic
|
||||||
* @param rigidBodyLevel: physics object of the level
|
* @param rigidBodyLevel: physics object of the level
|
||||||
* @param obj: physics object for the object that collided with the level
|
* @param obj: physics object for the object that collided with the level
|
||||||
********************************************************/
|
********************************************************/
|
||||||
static Oyster::Physics::ICustomBody::SubscriptMessage LevelCollision(const Oyster::Physics::ICustomBody *rigidBodyLevel, const Oyster::Physics::ICustomBody *obj);
|
static void LevelCollision(const Oyster::Physics::ICustomBody *rigidBodyLevel, const Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TeamManager teamManager;
|
TeamManager teamManager;
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace GameLogic
|
||||||
* @param rigidBodyPlayer: physics object of the player
|
* @param rigidBodyPlayer: physics object of the player
|
||||||
* @param obj: physics object for the object that collided with the player
|
* @param obj: physics object for the object that collided with the player
|
||||||
********************************************************/
|
********************************************************/
|
||||||
static Oyster::Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj);
|
static void PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
||||||
|
|
||||||
|
|
||||||
bool IsWalking();
|
bool IsWalking();
|
||||||
|
|
Loading…
Reference in New Issue