Updates for objects

This commit is contained in:
Robin Engman 2014-02-10 13:25:28 +01:00
parent ba0d6ca73a
commit e5e99924d9
4 changed files with 9 additions and 4 deletions

View File

@ -483,7 +483,7 @@ void GameState::Protocol( ObjPos* pos )
if(privData->object[i]->GetId() == pos->object_ID) if(privData->object[i]->GetId() == pos->object_ID)
{ {
privData->object[i]->setPos(world); privData->object[i]->setPos(world);
Oyster::Math::Float3 position = Oyster::Math::Float3(0, 605, 15); Oyster::Math::Float3 position = Oyster::Math::Float3(0, 605, -15);
if(pos->object_ID == myId) // playerobj if(pos->object_ID == myId) // playerobj
{ {
//printf("Move message recieved!"); //printf("Move message recieved!");

View File

@ -105,7 +105,10 @@ bool Game::NewFrame()
if(this->players[i]->player) this->players[i]->player->EndFrame(); if(this->players[i]->player) this->players[i]->player->EndFrame();
gameInstance.onMoveFnc(this->players[i]); gameInstance.onMoveFnc(this->players[i]);
} }
for (unsigned int i = 0; i < this->level->level->dynamicObjects.Size(); i++)
{
gameInstance.onMoveFnc(this->level->level->dynamicObjects[i]);
}
return true; return true;

View File

@ -13,6 +13,8 @@ Level::Level(void)
} }
Level::~Level(void) Level::~Level(void)
{ {
delete this->levelObj;
this->levelObj = NULL;
} }
void Level::InitiateLevel(std::string levelPath) void Level::InitiateLevel(std::string levelPath)
@ -70,7 +72,7 @@ void Level::InitiateLevel(float radius)
int offset = 0; int offset = 0;
for(int i =0; i< nrOfBoxex; i ++) for(int i =0; i< nrOfBoxex; i ++)
{ {
rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 605 + i*5, -10), 5); rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 605 + i*5, 10), 5);
this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX));
this->dynamicObjects[i]->objectID = idCount++; this->dynamicObjects[i]->objectID = idCount++;

View File

@ -65,7 +65,7 @@ namespace GameLogic
static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object); static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object);
private: //private:
TeamManager teamManager; TeamManager teamManager;
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> staticObjects; Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> staticObjects;
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> dynamicObjects; Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> dynamicObjects;