diff --git a/Escape-the-Dawn/Sounds/Explosion1.wav b/Escape-the-Dawn/Sounds/Explosion1.wav new file mode 100644 index 0000000..8199657 Binary files /dev/null and b/Escape-the-Dawn/Sounds/Explosion1.wav differ diff --git a/Escape-the-Dawn/Sounds/Explosion2.wav b/Escape-the-Dawn/Sounds/Explosion2.wav new file mode 100644 index 0000000..1849bfa Binary files /dev/null and b/Escape-the-Dawn/Sounds/Explosion2.wav differ diff --git a/Escape-the-Dawn/Sounds/Explosion3.wav b/Escape-the-Dawn/Sounds/Explosion3.wav new file mode 100644 index 0000000..17473cd Binary files /dev/null and b/Escape-the-Dawn/Sounds/Explosion3.wav differ diff --git a/Escape-the-Dawn/Systems/CollisionSystem.cpp b/Escape-the-Dawn/Systems/CollisionSystem.cpp index 419ef41..1e80841 100644 --- a/Escape-the-Dawn/Systems/CollisionSystem.cpp +++ b/Escape-the-Dawn/Systems/CollisionSystem.cpp @@ -70,7 +70,6 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity) return; auto transformSystem = m_World->GetSystem("TransformSystem"); - auto aBounds = m_World->GetComponent(aEntity, "Bounds"); auto bBounds = m_World->GetComponent(bEntity, "Bounds"); diff --git a/Escape-the-Dawn/Systems/CollisionSystem.cpp.orig b/Escape-the-Dawn/Systems/CollisionSystem.cpp.orig index 572fc4a..8808b07 100644 --- a/Escape-the-Dawn/Systems/CollisionSystem.cpp.orig +++ b/Escape-the-Dawn/Systems/CollisionSystem.cpp.orig @@ -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(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("TransformSystem"); +>>>>>>> b81d60799e242ee073f5fa8bf1996c8c5878db06 auto aBounds = m_World->GetComponent(aEntity, "Bounds"); - auto bBounds = m_World->GetComponent(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_ptrGetProperty(ent, "Name") == "Obstacle") { + + auto deathSoundEntity = m_World->CreateEntity(ent); + + auto deathTransform = m_World->AddComponent(deathSoundEntity, "Transform"); + auto deathSoundEmitter = m_World->AddComponent(deathSoundEntity, "SoundEmitter"); + deathSoundEmitter->Gain = 5.f; + deathSoundEmitter->ReferenceDistance = 1.5f; + + auto deathSoundSystem = m_World->GetSystem("SoundSystem"); + deathSoundSystem->PlaySound(deathSoundEmitter.get(), "Sounds/Explosion3.wav"); + m_World->RemoveEntity(entity); + + //TODO: Ljud som kommer från crashsite } if (m_World->GetProperty(ent, "Name") == "Obstacle_SoundTrigger") diff --git a/Escape-the-Dawn/Systems/PlayerSystem.h b/Escape-the-Dawn/Systems/PlayerSystem.h index 84fee4d..169a4d8 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.h +++ b/Escape-the-Dawn/Systems/PlayerSystem.h @@ -32,7 +32,6 @@ namespace Systems private: float m_PlayerSpeed; glm::vec3 m_PlayerOriginalBounds; - glm::vec3 m_CameraOffset; glm::quat m_CameraOrientation;