Sound when crashing into obstacle added
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -69,7 +69,6 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
|||||||
if(bCollisionComponent == nullptr)
|
if(bCollisionComponent == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
||||||
|
|
||||||
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ void Systems::LevelGenerationSystem::SpawnObstacle()
|
|||||||
|
|
||||||
void Systems::LevelGenerationSystem::Update( double dt )
|
void Systems::LevelGenerationSystem::Update( double dt )
|
||||||
{
|
{
|
||||||
|
|
||||||
elapsedtime += dt;
|
elapsedtime += dt;
|
||||||
spawnFrequency = 10/velocity;
|
spawnFrequency = 10/velocity;
|
||||||
|
|
||||||
@@ -91,9 +90,6 @@ void Systems::LevelGenerationSystem::Update( double dt )
|
|||||||
SpawnObstacle();
|
SpawnObstacle();
|
||||||
elapsedtime = 0;
|
elapsedtime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Systems::LevelGenerationSystem::UpdateEntity( double dt, EntityID entity, EntityID parent )
|
void Systems::LevelGenerationSystem::UpdateEntity( double dt, EntityID entity, EntityID parent )
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Systems::PlayerSystem::PlayerSystem( World* world ) : System(world)
|
|||||||
m_poweruptimeleft = 0;
|
m_poweruptimeleft = 0;
|
||||||
m_basespeed = 125.f;
|
m_basespeed = 125.f;
|
||||||
m_maxspeed = 125.f;
|
m_maxspeed = 125.f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Systems::PlayerSystem::Update(double dt)
|
void Systems::PlayerSystem::Update(double dt)
|
||||||
@@ -196,7 +197,20 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
|
|||||||
{
|
{
|
||||||
if(m_World->GetProperty<std::string>(ent, "Name") == "Obstacle")
|
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);
|
m_World->RemoveEntity(entity);
|
||||||
|
|
||||||
|
//TODO: Ljud som kommer från crashsite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ namespace Systems
|
|||||||
private:
|
private:
|
||||||
float m_PlayerSpeed;
|
float m_PlayerSpeed;
|
||||||
glm::vec3 m_PlayerOriginalBounds;
|
glm::vec3 m_PlayerOriginalBounds;
|
||||||
|
|
||||||
glm::vec3 m_CameraOffset;
|
glm::vec3 m_CameraOffset;
|
||||||
glm::quat m_CameraOrientation;
|
glm::quat m_CameraOrientation;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user