diff --git a/Code/Game/GameLogic/Game.cpp b/Code/Game/GameLogic/Game.cpp index 64ab7c57..d102aa16 100644 --- a/Code/Game/GameLogic/Game.cpp +++ b/Code/Game/GameLogic/Game.cpp @@ -55,7 +55,7 @@ struct Game::PrivateData } DynamicArray players; - SmartPointer level; + SmartPointer level; Utility::WinTimer timer; }myData; @@ -88,6 +88,16 @@ Game::PlayerData* Game::CreatePlayer() return this->myData->players[id]; } +Game::LevelData* Game::CreateLevel() +{ + Level *newLevel = new Level(); + newLevel->InitiateLevel(1000); + LevelData *newLdata = new LevelData(); + newLdata->level = newLevel; + myData->level = newLdata; + return myData->level; +} + void Game::CreateTeam() { diff --git a/Code/Game/GameLogic/Game.h b/Code/Game/GameLogic/Game.h index 3a860653..0cd9b2a8 100644 --- a/Code/Game/GameLogic/Game.h +++ b/Code/Game/GameLogic/Game.h @@ -65,6 +65,19 @@ namespace GameLogic int GetTeamID() const; }; + struct DANBIAS_GAMELOGIC_DLL LevelData + { + private: + friend class Game; + Level *level; + LevelData(); + ~LevelData(); + + public: + + + }; + public: Game(void); ~Game(void); @@ -75,10 +88,15 @@ namespace GameLogic void GetAllPlayerPositions() const; /******************************************************** - * Creates a player and returns PlayerData containing ID of the player + * Creates a player and returns PlayerData ********************************************************/ PlayerData* CreatePlayer(); + /******************************************************** + * Creates a level and returns LevelData + ********************************************************/ + LevelData* CreateLevel(); + /******************************************************** * Creates a team ********************************************************/ diff --git a/Code/Game/GameLogic/Game_LevelData.cpp b/Code/Game/GameLogic/Game_LevelData.cpp new file mode 100644 index 00000000..a9a5394e --- /dev/null +++ b/Code/Game/GameLogic/Game_LevelData.cpp @@ -0,0 +1,14 @@ +#include "Game.h" +#include "Level.h" + +using namespace GameLogic; + +Game::LevelData::LevelData() +{ + +} + +Game::LevelData::~LevelData() +{ + +} \ No newline at end of file diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 81cad9e9..4ce96dee 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -51,14 +51,22 @@ void Level::InitiateLevel(std::string levelPath) void Level::InitiateLevel(float radius) { API::SphericalBodyDescription sbDesc; - sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,0); + sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1); sbDesc.ignoreGravity = true; sbDesc.radius = radius; - sbDesc.mass = 1e16; //10^20 + sbDesc.mass = 1e16; //10^16 sbDesc.subscription = CollisionManager::LevelCollision; ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); + API::Instance().AddObject(rigidBody); + API::Gravity gravityWell; + + gravityWell.gravityType = API::Gravity::GravityType_Well; + gravityWell.well.mass = (float)1e16; + gravityWell.well.position = Oyster::Math::Float4(0,0,0,1); + + API::Instance().AddGravity(gravityWell); }