GL - updated constructors to set before and after collision response functions
This commit is contained in:
parent
3a9c47722a
commit
446bdd412b
|
@ -64,10 +64,18 @@ using namespace GameLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//Oyster::Physics::ICustomBody::SubscriptMessage
|
Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj)
|
||||||
void Level::LevelCollision(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
|
||||||
{
|
{
|
||||||
//return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
|
}
|
||||||
|
//Oyster::Physics::ICustomBody::SubscriptMessage
|
||||||
|
Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj)
|
||||||
|
{
|
||||||
|
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
||||||
|
}
|
||||||
|
Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
|
{
|
||||||
|
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void* args)
|
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void* args)
|
||||||
|
|
|
@ -9,19 +9,32 @@ DynamicObject::DynamicObject()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
DynamicObject::DynamicObject(OBJECT_TYPE type)
|
||||||
|
:Object(type)
|
||||||
|
{
|
||||||
|
|
||||||
DynamicObject::DynamicObject(void* collisionFunc, OBJECT_TYPE type)
|
}
|
||||||
:Object(collisionFunc, type)
|
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type)
|
||||||
|
:Object(rigidBody,type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
DynamicObject::DynamicObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
:Object(rigidBody, collisionFunc, type)
|
:Object(collisionFuncBefore,collisionFuncAfter,type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
|
:Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
||||||
|
:Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
DynamicObject::~DynamicObject(void)
|
DynamicObject::~DynamicObject(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,8 +14,12 @@ namespace GameLogic
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DynamicObject();
|
DynamicObject();
|
||||||
DynamicObject(void* collisionFunc, OBJECT_TYPE type);
|
DynamicObject(OBJECT_TYPE type);
|
||||||
DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
DynamicObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type);
|
||||||
|
DynamicObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
||||||
|
|
||||||
~DynamicObject(void);
|
~DynamicObject(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -100,30 +100,6 @@ bool Game::NewFrame()
|
||||||
|
|
||||||
API::Instance().Update();
|
API::Instance().Update();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < this->players.Size(); i++)
|
|
||||||
{
|
|
||||||
if(this->players[i]->player) this->players[i]->player->EndFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < this->players.Size(); i++)
|
|
||||||
{
|
|
||||||
if(this->players[i]->player) this->players[i]->player->BeginFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
API::Instance().Update();
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < this->players.Size(); i++)
|
|
||||||
{
|
|
||||||
if(this->players[i]->player) this->players[i]->player->EndFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < this->players.Size(); i++)
|
|
||||||
{
|
|
||||||
if(this->players[i]->player) this->players[i]->player->BeginFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
API::Instance().Update();
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < this->players.Size(); i++)
|
for (unsigned int i = 0; i < this->players.Size(); i++)
|
||||||
{
|
{
|
||||||
if(this->players[i]->player) this->players[i]->player->EndFrame();
|
if(this->players[i]->player) this->players[i]->player->EndFrame();
|
||||||
|
|
|
@ -5,15 +5,18 @@ using namespace GameLogic;
|
||||||
|
|
||||||
Game::PlayerData::PlayerData()
|
Game::PlayerData::PlayerData()
|
||||||
{
|
{
|
||||||
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
|
||||||
//set some stats that are appropriate to a player
|
//set some stats that are appropriate to a player
|
||||||
|
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
||||||
|
sbDesc.centerPosition = Oyster::Math::Float3(0,15,0);
|
||||||
|
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
||||||
|
|
||||||
//create rigid body
|
//create rigid body
|
||||||
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
|
||||||
//create player with this rigid body
|
//create player with this rigid body
|
||||||
this->player = new Player(rigidBody,Player::PlayerCollision,OBJECT_TYPE::OBJECT_TYPE_PLAYER);
|
this->player = new Player(rigidBody,Object::DefaultCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER);
|
||||||
this->player->GetRigidBody()->SetCustomTag(this);
|
this->player->GetRigidBody()->SetCustomTag(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
Game::PlayerData::PlayerData(int playerID,int teamID)
|
Game::PlayerData::PlayerData(int playerID,int teamID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ void Level::InitiateLevel(std::string levelPath)
|
||||||
}
|
}
|
||||||
void Level::InitiateLevel(float radius)
|
void Level::InitiateLevel(float radius)
|
||||||
{
|
{
|
||||||
|
|
||||||
// add level sphere
|
// add level sphere
|
||||||
API::SphericalBodyDescription sbDesc;
|
API::SphericalBodyDescription sbDesc;
|
||||||
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
|
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
|
||||||
|
@ -34,7 +35,7 @@ void Level::InitiateLevel(float radius)
|
||||||
state.SetRestitutionCoeff(0.01);
|
state.SetRestitutionCoeff(0.01);
|
||||||
rigidBody->SetState(state);
|
rigidBody->SetState(state);
|
||||||
|
|
||||||
levelObj = new StaticObject(rigidBody, LevelCollision, OBJECT_TYPE::OBJECT_TYPE_WORLD);
|
levelObj = new StaticObject(rigidBody, LevelCollisionBefore, LevelCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_WORLD);
|
||||||
rigidBody->SetCustomTag(levelObj);
|
rigidBody->SetCustomTag(levelObj);
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +48,8 @@ void Level::InitiateLevel(float radius)
|
||||||
|
|
||||||
ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release();
|
ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release();
|
||||||
rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel);
|
rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel);
|
||||||
testBox = new DynamicObject(rigidBody_TestBox,LevelCollision,OBJECT_TYPE::OBJECT_TYPE_BOX);
|
|
||||||
|
testBox = new DynamicObject(rigidBody_TestBox, OBJECT_TYPE::OBJECT_TYPE_BOX);
|
||||||
rigidBody_TestBox->SetCustomTag(testBox);
|
rigidBody_TestBox->SetCustomTag(testBox);
|
||||||
rigidBody_TestBox->GetState(state);
|
rigidBody_TestBox->GetState(state);
|
||||||
state.ApplyLinearImpulse(Oyster::Math::Float3(0,0,4));
|
state.ApplyLinearImpulse(Oyster::Math::Float3(0,0,4));
|
||||||
|
|
|
@ -57,7 +57,8 @@ 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 void LevelCollision(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
static Oyster::Physics::ICustomBody::SubscriptMessage LevelCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj);
|
||||||
|
static Oyster::Physics::ICustomBody::SubscriptMessage LevelCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
||||||
|
|
||||||
Object* GetObj( int ID ) const;
|
Object* GetObj( int ID ) const;
|
||||||
static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object);
|
static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object);
|
||||||
|
|
|
@ -16,59 +16,78 @@ const Game *Object::gameInstance = (Game*)(&Game::Instance());
|
||||||
Object::Object()
|
Object::Object()
|
||||||
{
|
{
|
||||||
API::SimpleBodyDescription sbDesc;
|
API::SimpleBodyDescription sbDesc;
|
||||||
//sbDesc.centerPosition =
|
|
||||||
|
|
||||||
//poi
|
|
||||||
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
|
||||||
|
|
||||||
|
|
||||||
|
this->rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
||||||
|
|
||||||
//rigidBody->gameObjectRef = this;
|
|
||||||
|
|
||||||
this->objectID = GID();
|
|
||||||
|
|
||||||
this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN;
|
this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN;
|
||||||
|
this->objectID = GID();
|
||||||
|
this->getState = this->rigidBody->GetState();
|
||||||
|
this->setState = this->getState;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
Object::Object(OBJECT_TYPE type)
|
||||||
{
|
{
|
||||||
API::SimpleBodyDescription sbDesc;
|
API::SimpleBodyDescription sbDesc;
|
||||||
|
|
||||||
//poi
|
|
||||||
this->rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
this->rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
|
||||||
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
||||||
|
|
||||||
//rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc));
|
|
||||||
|
|
||||||
//rigidBody->gameObjectRef = this;
|
|
||||||
|
|
||||||
this->objectID = GID();
|
|
||||||
|
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
this->objectID = GID();
|
||||||
|
this->getState = this->rigidBody->GetState();
|
||||||
|
this->setState = this->getState;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Object(ICustomBody *rigidBody ,void* collisionFunc, OBJECT_TYPE type)
|
Object::Object(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type)
|
||||||
{
|
{
|
||||||
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
||||||
|
|
||||||
//rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc));
|
|
||||||
|
|
||||||
this->objectID = GID();
|
|
||||||
|
|
||||||
this->type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object::Object(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
|
||||||
{
|
|
||||||
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
|
||||||
//rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc));
|
|
||||||
|
|
||||||
this->rigidBody = rigidBody;
|
this->rigidBody = rigidBody;
|
||||||
this->type = type;
|
this->type = type;
|
||||||
this->objectID = GID();
|
this->objectID = GID();
|
||||||
|
this->getState = this->rigidBody->GetState();
|
||||||
|
this->setState = this->getState;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::Object(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
|
{
|
||||||
|
API::SimpleBodyDescription sbDesc;
|
||||||
|
|
||||||
|
this->rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
||||||
|
|
||||||
|
this->type = type;
|
||||||
|
this->objectID = GID();
|
||||||
|
this->getState = this->rigidBody->GetState();
|
||||||
|
this->setState = this->getState;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::Object(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
|
{
|
||||||
|
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
||||||
|
|
||||||
|
this->rigidBody = rigidBody;
|
||||||
|
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse)(collisionFuncBefore));
|
||||||
|
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
|
||||||
|
|
||||||
|
this->type = type;
|
||||||
|
this->objectID = GID();
|
||||||
|
this->getState = this->rigidBody->GetState();
|
||||||
|
this->setState = this->getState;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::Object(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
||||||
|
{
|
||||||
|
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
||||||
|
|
||||||
|
this->rigidBody = rigidBody;
|
||||||
|
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse)(collisionFuncBefore));
|
||||||
|
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
|
||||||
|
|
||||||
|
|
||||||
|
this->type = type;
|
||||||
|
this->objectID = GID();
|
||||||
|
this->getState = this->rigidBody->GetState();
|
||||||
|
this->setState = this->getState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::ApplyLinearImpulse(Oyster::Math::Float3 force)
|
void Object::ApplyLinearImpulse(Oyster::Math::Float3 force)
|
||||||
|
@ -107,19 +126,12 @@ void Object::BeginFrame()
|
||||||
void Object::EndFrame()
|
void Object::EndFrame()
|
||||||
{
|
{
|
||||||
|
|
||||||
//Oyster::Math::Float rot = (setState.GetGravityNormal().xyz).Dot(getState.GetGravityNormal().xyz);
|
|
||||||
//Oyster::Math::Float3 axis = (setState.GetGravityNormal().xyz).Cross(getState.GetGravityNormal().xyz);
|
|
||||||
Oyster::Math::Float4x4 rotMatrix = setState.GetOrientation(); //Oyster::Math3D::RotationMatrix(rot, axis);
|
Oyster::Math::Float4x4 rotMatrix = setState.GetOrientation(); //Oyster::Math3D::RotationMatrix(rot, axis);
|
||||||
//Oyster::Math3D::SnapAxisYToNormal_UsingNlerp(rotMatrix, -setState.GetGravityNormal());
|
//Oyster::Math3D::SnapAxisYToNormal_UsingNlerp(rotMatrix, -setState.GetGravityNormal());
|
||||||
//setState.SetOrientation(rotMatrix);
|
//setState.SetOrientation(rotMatrix);
|
||||||
|
|
||||||
|
|
||||||
this->getState = this->rigidBody->GetState();
|
this->getState = this->rigidBody->GetState();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this->setState = this->getState;
|
this->setState = this->getState;
|
||||||
|
|
||||||
}
|
}
|
||||||
Oyster::Math::Float3 Object::GetPosition()
|
Oyster::Math::Float3 Object::GetPosition()
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,9 +18,11 @@ namespace GameLogic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Object();
|
Object();
|
||||||
Object(void* collisionFunc, OBJECT_TYPE type);
|
Object(OBJECT_TYPE type);
|
||||||
Object(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFunc, OBJECT_TYPE type);
|
Object(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type);
|
||||||
Object(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
Object(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
Object(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
Object(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
||||||
~Object(void);
|
~Object(void);
|
||||||
|
|
||||||
// API overrides
|
// API overrides
|
||||||
|
@ -35,7 +37,7 @@ namespace GameLogic
|
||||||
|
|
||||||
void BeginFrame();
|
void BeginFrame();
|
||||||
void EndFrame();
|
void EndFrame();
|
||||||
|
static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj);
|
||||||
private:
|
private:
|
||||||
OBJECT_TYPE type;
|
OBJECT_TYPE type;
|
||||||
int objectID;
|
int objectID;
|
||||||
|
|
|
@ -8,20 +8,38 @@ using namespace GameLogic;
|
||||||
using namespace Oyster::Physics;
|
using namespace Oyster::Physics;
|
||||||
|
|
||||||
Player::Player()
|
Player::Player()
|
||||||
:DynamicObject(Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER)
|
:DynamicObject()
|
||||||
{
|
{
|
||||||
weapon = new Weapon();
|
|
||||||
|
|
||||||
life = 100;
|
}
|
||||||
teamID = -1;
|
Player::Player(OBJECT_TYPE type)
|
||||||
playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
:DynamicObject(type)
|
||||||
lookDir = Oyster::Math::Float4(0,0,-1,0);
|
{
|
||||||
setState.SetCenterPosition(Oyster::Math::Float3(0,15,0));
|
InitPlayer();
|
||||||
setState.SetReach(Oyster::Math::Float3(2,3.5,2));
|
}
|
||||||
|
Player::Player(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type)
|
||||||
|
:DynamicObject(rigidBody,type)
|
||||||
|
{
|
||||||
|
InitPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::Player(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
Player::Player(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
:DynamicObject(rigidBody, collisionFunc, type)
|
:DynamicObject(collisionFuncBefore,collisionFuncAfter,type)
|
||||||
|
{
|
||||||
|
InitPlayer();
|
||||||
|
}
|
||||||
|
Player::Player(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
|
:DynamicObject(rigidBody, collisionFuncBefore, collisionFuncAfter, type)
|
||||||
|
{
|
||||||
|
InitPlayer();
|
||||||
|
}
|
||||||
|
Player::Player(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
||||||
|
:DynamicObject(rigidBody, collisionFuncBefore, collisionFuncAfter, type)
|
||||||
|
{
|
||||||
|
InitPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::InitPlayer()
|
||||||
{
|
{
|
||||||
weapon = new Weapon(2,this);
|
weapon = new Weapon(2,this);
|
||||||
|
|
||||||
|
@ -29,9 +47,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oy
|
||||||
this->teamID = -1;
|
this->teamID = -1;
|
||||||
this->playerState = PLAYER_STATE_IDLE;
|
this->playerState = PLAYER_STATE_IDLE;
|
||||||
lookDir = Oyster::Math::Float4(0,0,-1,0);
|
lookDir = Oyster::Math::Float4(0,0,-1,0);
|
||||||
|
|
||||||
setState.SetCenterPosition(Oyster::Math::Float3(0,15,0));
|
|
||||||
setState.SetReach(Oyster::Math::Float3(2,3.5,2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player(void)
|
Player::~Player(void)
|
||||||
|
@ -41,10 +56,8 @@ Player::~Player(void)
|
||||||
delete weapon;
|
delete weapon;
|
||||||
weapon = NULL;
|
weapon = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Player::Move(const PLAYER_MOVEMENT &movement)
|
void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
{
|
{
|
||||||
switch(movement)
|
switch(movement)
|
||||||
|
|
|
@ -16,8 +16,13 @@ namespace GameLogic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Player(void);
|
Player(void);
|
||||||
Player(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
Player(OBJECT_TYPE type);
|
||||||
|
Player(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type);
|
||||||
|
Player(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
Player(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
Player(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
||||||
~Player(void);
|
~Player(void);
|
||||||
|
void InitPlayer();
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Moves the player based on input
|
* Moves the player based on input
|
||||||
|
|
|
@ -8,29 +8,33 @@ StaticObject::StaticObject()
|
||||||
:Object()
|
:Object()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
StaticObject::StaticObject(void* collisionFunc, OBJECT_TYPE type)
|
|
||||||
:Object(collisionFunc,type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
StaticObject::StaticObject(OBJECT_TYPE type)
|
StaticObject::StaticObject(OBJECT_TYPE type)
|
||||||
:Object(NULL,type)
|
:Object(type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody,void* collisionFunc, OBJECT_TYPE type)
|
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type)
|
||||||
:Object(rigidBody,collisionFunc,type)
|
:Object(rigidBody,type)
|
||||||
{
|
|
||||||
|
|
||||||
}*/
|
|
||||||
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
|
||||||
:Object(rigidBody, collisionFunc, type)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StaticObject::StaticObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
|
:Object(collisionFuncBefore,collisionFuncAfter,type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||||
|
:Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type)
|
||||||
|
:Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
StaticObject::~StaticObject(void)
|
StaticObject::~StaticObject(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,10 +16,12 @@ namespace GameLogic
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StaticObject();
|
StaticObject();
|
||||||
StaticObject(void* collisionFunc, OBJECT_TYPE type);
|
|
||||||
//StaticObject(Oyster::Physics::ICustomBody *rigidBody,void* collisionFunc, OBJECT_TYPE type);
|
|
||||||
StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
|
||||||
StaticObject(OBJECT_TYPE type);
|
StaticObject(OBJECT_TYPE type);
|
||||||
|
StaticObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type);
|
||||||
|
StaticObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type);
|
||||||
|
StaticObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type);
|
||||||
|
|
||||||
~StaticObject(void);
|
~StaticObject(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue