Merge branch 'master' of github.com:sippeangelo/Escape-the-Dawn
Conflicts: Escape-the-Dawn/Systems/PlayerSystem.cpp
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -70,7 +70,6 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
||||
return;
|
||||
|
||||
auto transformSystem = m_World->GetSystem<Systems::TransformSystem>("TransformSystem");
|
||||
|
||||
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
||||
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@ void Systems::CollisionSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
transform->Position[0] += parentTransform->Position[0];
|
||||
transform->Position[1] += parentTransform->Position[1];
|
||||
transform->Position[2] += parentTransform->Position[2];
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}*/
|
||||
|
||||
auto collisionComponent = m_World->GetComponent<Components::Collision>(entity, "Collision");
|
||||
@@ -26,7 +23,6 @@ void Systems::CollisionSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
// Quit out if we're not interested in collision events
|
||||
if (!collisionComponent->Interested)
|
||||
return;
|
||||
>>>>>>> f76c0b336f87a259a7eabf3c532fc885f155a605
|
||||
|
||||
auto entities = m_World->GetEntities();
|
||||
|
||||
@@ -73,13 +69,16 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
||||
if(bCollisionComponent == nullptr)
|
||||
return;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
auto transformSystem = m_World->GetSystem<Systems::TransformSystem>("TransformSystem");
|
||||
|
||||
>>>>>>> b81d60799e242ee073f5fa8bf1996c8c5878db06
|
||||
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
||||
|
||||
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
||||
|
||||
glm::vec3 aPos = aTransform->Position + (aBounds->Origin * aTransform->Scale);
|
||||
glm::vec3 bPos = bTransform->Position + (bBounds->Origin * bTransform->Scale);
|
||||
glm::vec3 aPos = transformSystem->AbsolutePosition(aEntity) + (aBounds->Origin * aTransform->Scale);
|
||||
glm::vec3 bPos = transformSystem->AbsolutePosition(bEntity) + (bBounds->Origin * bTransform->Scale);
|
||||
|
||||
glm::vec3 aMax = aPos + aBounds->VolumeVector * aTransform->Scale;
|
||||
glm::vec3 aMin = aPos - aBounds->VolumeVector * aTransform->Scale;
|
||||
@@ -89,8 +88,8 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
||||
if (aMin.x <= bMax.x && bMin.x <= aMax.x) {
|
||||
if (aMin.y <= bMax.y && bMin.y <= aMax.y) {
|
||||
if (aMin.z <= bMax.z && bMin.z <= aMax.z) {
|
||||
aCollisionComponent->CollidingEntities.push_back(aEntity);
|
||||
bCollisionComponent->CollidingEntities.push_back(bEntity);
|
||||
aCollisionComponent->CollidingEntities.push_back(bEntity);
|
||||
bCollisionComponent->CollidingEntities.push_back(aEntity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +122,7 @@ void Systems::CollisionSystem::CreateBoundingBox(std::shared_ptr<Components::Bou
|
||||
GLushort elements[] = {
|
||||
0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
0, 4, 1, 5,
|
||||
0, 4, 1, 5,
|
||||
2, 6, 3, 7
|
||||
};
|
||||
GLuint ibo_elements;
|
||||
|
||||
@@ -95,7 +95,6 @@ void Systems::LevelGenerationSystem::SpawnObstacle()
|
||||
|
||||
void Systems::LevelGenerationSystem::Update( double dt )
|
||||
{
|
||||
|
||||
elapsedtime += dt;
|
||||
spawnFrequency = 10/velocity;
|
||||
|
||||
@@ -103,9 +102,6 @@ void Systems::LevelGenerationSystem::Update( double dt )
|
||||
SpawnObstacle();
|
||||
elapsedtime = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Systems::LevelGenerationSystem::UpdateEntity( double dt, EntityID entity, EntityID parent )
|
||||
|
||||
@@ -14,6 +14,7 @@ Systems::PlayerSystem::PlayerSystem( World* world ) : System(world)
|
||||
m_poweruptimeleft = 0;
|
||||
m_basespeed = 125.f;
|
||||
m_maxspeed = 125.f;
|
||||
|
||||
}
|
||||
|
||||
void Systems::PlayerSystem::Update(double dt)
|
||||
@@ -195,7 +196,20 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
|
||||
{
|
||||
if(m_World->GetProperty<std::string>(ent, "Name") == "Obstacle")
|
||||
{
|
||||
|
||||
auto deathSoundEntity = m_World->CreateEntity(ent);
|
||||
|
||||
auto deathTransform = m_World->AddComponent<Components::Transform>(deathSoundEntity, "Transform");
|
||||
auto deathSoundEmitter = m_World->AddComponent<Components::SoundEmitter>(deathSoundEntity, "SoundEmitter");
|
||||
deathSoundEmitter->Gain = 5.f;
|
||||
deathSoundEmitter->ReferenceDistance = 1.5f;
|
||||
|
||||
auto deathSoundSystem = m_World->GetSystem<Systems::SoundSystem>("SoundSystem");
|
||||
deathSoundSystem->PlaySound(deathSoundEmitter.get(), "Sounds/Explosion3.wav");
|
||||
|
||||
m_World->RemoveEntity(entity);
|
||||
|
||||
//TODO: Ljud som kommer från crashsite
|
||||
}
|
||||
|
||||
if (m_World->GetProperty<std::string>(ent, "Name") == "Obstacle_SoundTrigger")
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace Systems
|
||||
private:
|
||||
float m_PlayerSpeed;
|
||||
glm::vec3 m_PlayerOriginalBounds;
|
||||
|
||||
glm::vec3 m_CameraOffset;
|
||||
glm::quat m_CameraOrientation;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user