Danbias/Code/Game/GameLogic/Level.cpp

81 lines
1.8 KiB
C++
Raw Normal View History

2013-11-19 11:07:14 +01:00
#include "Level.h"
2014-01-20 15:47:52 +01:00
#include "CollisionManager.h"
2013-11-19 11:07:14 +01:00
using namespace GameLogic;
using namespace Utility::DynamicMemory;
2014-01-16 11:40:29 +01:00
using namespace Oyster::Physics;
2013-11-19 11:07:14 +01:00
2013-12-05 11:50:39 +01:00
2013-11-19 11:07:14 +01:00
Level::Level(void)
{
}
Level::~Level(void)
{
}
void Level::InitiateLevel(std::string levelPath)
{
2014-01-16 11:40:29 +01:00
}
void Level::InitiateLevel(float radius)
{
2014-01-21 14:28:27 +01:00
API::SphericalBodyDescription sbDesc;
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
sbDesc.ignoreGravity = true;
sbDesc.radius = 8; //radius;
sbDesc.mass = 10e12f;
2014-01-20 15:47:52 +01:00
//sbDesc.mass = 0; //10^16
2014-01-23 09:14:04 +01:00
2014-01-23 08:57:46 +01:00
2014-01-21 14:28:27 +01:00
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
//rigidBody->SetCustomTag(levelObj);
2014-01-23 09:14:04 +01:00
2014-01-21 14:28:27 +01:00
ICustomBody::State state;
rigidBody->GetState(state);
state.SetRestitutionCoeff(0.1);
rigidBody->SetState(state);
2014-01-23 09:14:04 +01:00
levelObj = new StaticObject(rigidBody, LevelCollision, OBJECT_TYPE::OBJECT_TYPE_WORLD);
2014-01-27 14:43:39 +01:00
API::SimpleBodyDescription sbDesc_TestBox;
sbDesc_TestBox.centerPosition = Oyster::Math::Float4(3,15,0,0);
sbDesc_TestBox.ignoreGravity = false;
sbDesc_TestBox.mass = 10;
sbDesc_TestBox.size = Oyster::Math::Float4(2,2,2,0);
//sbDesc.mass = 0; //10^16
ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release();
2014-01-27 14:43:39 +01:00
testBox = new DynamicObject(rigidBody_TestBox,LevelCollision,OBJECT_TYPE::OBJECT_TYPE_BOX);
/*API::Gravity gravityWell;
2014-01-21 14:28:27 +01:00
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)
{
2014-01-20 15:47:52 +01:00
this->teamManager.AddPlayerToTeam(player,teamID);
}
void Level::CreateTeam(int teamSize)
{
2014-01-20 15:47:52 +01:00
this->teamManager.CreateTeam(teamSize);
}
void Level::RespawnPlayer(Player *player)
{
2014-01-20 15:47:52 +01:00
this->teamManager.RespawnPlayerRandom(player);
}