GL - initiating objects

This commit is contained in:
lindaandersson 2014-02-14 11:07:03 +01:00
parent 50d07a102d
commit 1a01dbd760
1 changed files with 7 additions and 6 deletions

View File

@ -21,7 +21,7 @@ Level::~Level(void)
} }
Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
{ {
Object* gameObj =NULL; Object* gameObj = NULL;
switch ((ObjectSpecialType)obj->specialTypeID) switch ((ObjectSpecialType)obj->specialTypeID)
{ {
@ -64,8 +64,9 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
case ObjectSpecialType_RedExplosiveBox: case ObjectSpecialType_RedExplosiveBox:
{ {
int dmg = 50; int dmg = 50;
//gameObj = new ExplosiveBox(rigidBody, ObjectSpecialType_RedExplosiveBox); Oyster::Math::Float3 force(50, 50,50);
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); int radie = 50;
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID,objID++, dmg, force, radie);
} }
break; break;
//case ObjectSpecialType_BlueExplosiveBox: //case ObjectSpecialType_BlueExplosiveBox:
@ -98,14 +99,14 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
{ {
float power = ((JumpPadAttributes*)obj)->power; float power = ((JumpPadAttributes*)obj)->power;
Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction; Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction;
//gameObj = JumpPad(rigidBody, ); Oyster::Math::Float3 pushForce = dir * power;
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new JumpPad(rigidBody, (ObjectSpecialType)obj->specialTypeID,objID++ , pushForce);
} }
break; break;
case ObjectSpecialType_Portal: case ObjectSpecialType_Portal:
{ {
Oyster::Math::Float3 destination = ((PortalAttributes*)obj)->destination; Oyster::Math::Float3 destination = ((PortalAttributes*)obj)->destination;
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new Portal(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++, destination);
} }
break; break;
case ObjectSpecialType_SpawnPoint: case ObjectSpecialType_SpawnPoint: