GL - init objects

This commit is contained in:
lindaandersson 2014-02-14 11:11:49 +01:00
parent 9038277a2c
commit 975894b037
1 changed files with 17 additions and 17 deletions

View File

@ -26,14 +26,14 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
{ {
case ObjectSpecialType_None: case ObjectSpecialType_None:
{ {
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_Sky: case ObjectSpecialType_Sky:
{ {
float skySize = ((SkyAttributes*)obj)->skySize; float skySize = ((SkyAttributes*)obj)->skySize;
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_World: case ObjectSpecialType_World:
@ -43,29 +43,29 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
float worldSize = ((WorldAttributes*)obj)->worldSize; float worldSize = ((WorldAttributes*)obj)->worldSize;
float atmosphereSize = ((WorldAttributes*)obj)->atmoSphereSize; float atmosphereSize = ((WorldAttributes*)obj)->atmoSphereSize;
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_Building: case ObjectSpecialType_Building:
{ {
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
case ObjectSpecialType_Stone: case ObjectSpecialType_Stone:
{ {
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_StandardBox: case ObjectSpecialType_StandardBox:
{ {
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_RedExplosiveBox: case ObjectSpecialType_RedExplosiveBox:
{ {
int dmg = 50; int dmg = 50;
Oyster::Math::Float3 force(50, 50,50); Oyster::Math::Float force = 50;
int radie = 50; int radie = 50;
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID,objID++, dmg, force, radie); gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objID++, dmg, force, radie);
} }
break; break;
//case ObjectSpecialType_BlueExplosiveBox: //case ObjectSpecialType_BlueExplosiveBox:
@ -74,24 +74,24 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
// break; // break;
case ObjectSpecialType_SpikeBox: case ObjectSpecialType_SpikeBox:
{ {
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_Spike: case ObjectSpecialType_Spike:
{ {
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_CrystalFormation: case ObjectSpecialType_CrystalFormation:
{ {
int dmg = 50; int dmg = 50;
//gameObj = new Crystal(rigidBody); //gameObj = new Crystal(rigidBody);
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_CrystalShard: case ObjectSpecialType_CrystalShard:
{ {
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_JumpPad: case ObjectSpecialType_JumpPad:
@ -99,19 +99,19 @@ 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;
Oyster::Math::Float3 pushForce = dir * power; Oyster::Math::Float3 pushForce = dir * power;
gameObj = new JumpPad(rigidBody, (ObjectSpecialType)obj->specialTypeID,objID++ , pushForce); 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 Portal(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++, destination); gameObj = new Portal(rigidBody, (ObjectSpecialType)obj->specialTypeID, objID++, destination);
} }
break; break;
case ObjectSpecialType_SpawnPoint: case ObjectSpecialType_SpawnPoint:
{ {
// save // save
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
case ObjectSpecialType_Player: case ObjectSpecialType_Player:
@ -122,12 +122,12 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
break; break;
case ObjectSpecialType_Generic: case ObjectSpecialType_Generic:
{ {
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
default: default:
{ {
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
} }
break; break;
} }