Merge branch 'master' of github.com:sippeangelo/Escape-the-Dawn
Conflicts: Escape-the-Dawn/GameWorld.cpp Escape-the-Dawn/plane.obj
This commit is contained in:
@@ -4,7 +4,7 @@ Systems::LevelGenerationSystem::LevelGenerationSystem( World* world )
|
||||
: System(world)
|
||||
{
|
||||
elapsedtime = 0;
|
||||
startyz = glm::vec2(0, -200);
|
||||
startyz = glm::vec2(0, -1000);
|
||||
}
|
||||
|
||||
void Systems::LevelGenerationSystem::SpawnObstacle()
|
||||
@@ -12,7 +12,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle()
|
||||
|
||||
|
||||
|
||||
typeRandom = 0 + (rand() % 5);
|
||||
typeRandom = 0 + (rand() % 3);
|
||||
|
||||
|
||||
EntityID ent;
|
||||
@@ -25,45 +25,28 @@ void Systems::LevelGenerationSystem::SpawnObstacle()
|
||||
collision = m_World->AddComponent<Components::Collision>(ent, "Collision");
|
||||
model = m_World->AddComponent<Components::Model>(ent, "Model");
|
||||
|
||||
positionRandom = -500 + (rand() % 1000);
|
||||
|
||||
switch (typeRandom)
|
||||
{
|
||||
case 0:
|
||||
|
||||
positionRandom = -500 + (rand() % 1000);
|
||||
transform->Position = glm::vec3( positionRandom, startyz); // fix position
|
||||
bounds->VolumeVector = glm::vec3(4, 4, 4);
|
||||
bounds->VolumeVector = glm::vec3(9, 12, 7);
|
||||
bounds->Origin = glm::vec3(1,11,-1);
|
||||
model->ModelFile = "Models/obstacle_mountain_1.obj";
|
||||
|
||||
break;
|
||||
case 1:
|
||||
|
||||
positionRandom = -100 + (rand() % 200);
|
||||
transform->Position = glm::vec3( positionRandom, startyz); // fix position
|
||||
bounds->VolumeVector = glm::vec3(4, 4, 4);
|
||||
bounds->VolumeVector = glm::vec3(3.5f, 7.5f, 3.5f);
|
||||
bounds->Origin = glm::vec3(0,7.5f,0);
|
||||
model->ModelFile = "Models/obstacle_mountain_2.obj";
|
||||
|
||||
break;
|
||||
case 2:
|
||||
|
||||
positionRandom = -100 + (rand() % 200);
|
||||
transform->Position = glm::vec3( positionRandom, startyz); // fix position
|
||||
bounds->VolumeVector = glm::vec3(4, 4, 4);
|
||||
model->ModelFile = "Models/obstacle_mountain_3.obj";
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
||||
positionRandom = -100 + (rand() % 200);
|
||||
transform->Position = glm::vec3( positionRandom, startyz); // fix position
|
||||
bounds->VolumeVector = glm::vec3(4, 4, 4);
|
||||
model->ModelFile = "Models/obstacle_mountain_4.obj";
|
||||
|
||||
break;
|
||||
case 4:
|
||||
|
||||
positionRandom = -100 + (rand() % 200);
|
||||
transform->Position = glm::vec3( positionRandom, startyz); // fix position
|
||||
bounds->VolumeVector = glm::vec3(4, 4, 4);
|
||||
bounds->VolumeVector = glm::vec3(1, 1, 1);
|
||||
bounds->Origin = glm::vec3(0,1,0);
|
||||
model->ModelFile = "Models/obstacle_cube_1.obj";
|
||||
|
||||
break;
|
||||
@@ -78,16 +61,32 @@ void Systems::LevelGenerationSystem::Update( double dt )
|
||||
|
||||
elapsedtime += dt;
|
||||
|
||||
if(elapsedtime > 1.0){
|
||||
if(elapsedtime > 0.1){
|
||||
SpawnObstacle();
|
||||
elapsedtime = 0;
|
||||
}
|
||||
|
||||
std::vector<EntityID> removethis;
|
||||
|
||||
for(auto ent : obstacles)
|
||||
{
|
||||
auto transformComponent = m_World->GetComponent<Components::Transform>(ent, "Transform");
|
||||
transformComponent->Position.z += 15.f * dt;
|
||||
transformComponent->Position.z += 100.f * dt;
|
||||
|
||||
if(transformComponent->Position.z > 100)
|
||||
{
|
||||
removethis.push_back(ent);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for(auto ent : removethis)
|
||||
{
|
||||
m_World->RemoveEntity(ent);
|
||||
obstacles.remove(ent);
|
||||
}
|
||||
removethis.clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user