Danbias/Code/Game/GameLogic/Level.cpp

81 lines
1.7 KiB
C++

#include "Level.h"
#include "CollisionManager.h"
using namespace GameLogic;
using namespace Utility::DynamicMemory;
using namespace Oyster::Physics;
Level::Level(void)
{
}
Level::~Level(void)
{
}
void Level::InitiateLevel(std::string levelPath)
{
}
void Level::InitiateLevel(float radius)
{
API::SphericalBodyDescription sbDesc;
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
sbDesc.ignoreGravity = true;
sbDesc.radius = 8; //radius;
sbDesc.mass = 10e12f;
//sbDesc.mass = 0; //10^16
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
//rigidBody->SetCustomTag(levelObj);
ICustomBody::State state;
rigidBody->GetState(state);
state.SetRestitutionCoeff(0.1);
rigidBody->SetState(state);
levelObj = new StaticObject(rigidBody, LevelCollision, OBJECT_TYPE::OBJECT_TYPE_WORLD);
API::SphericalBodyDescription sbDesc_TestBox;
sbDesc.centerPosition = Oyster::Math::Float4(3,15,0,0);
sbDesc.ignoreGravity = true;
sbDesc.radius = 8; //radius;
sbDesc.mass = 10e12f;
//sbDesc.mass = 0; //10^16
ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release();
DynamicObject *testBox = new DynamicObject(rigidBody_TestBox,LevelCollision,OBJECT_TYPE::OBJECT_TYPE_BOX);
/*API::Gravity gravityWell;
gravityWell.gravityType = API::Gravity::GravityType_Well;
gravityWell.well.mass = 10e12f;
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
API::Instance().AddGravity(gravityWell);
*/
}
void Level::AddPlayerToTeam(Player *player, int teamID)
{
this->teamManager.AddPlayerToTeam(player,teamID);
}
void Level::CreateTeam(int teamSize)
{
this->teamManager.CreateTeam(teamSize);
}
void Level::RespawnPlayer(Player *player)
{
this->teamManager.RespawnPlayerRandom(player);
}