Fixed playsound event. Added remove sounds OnComponentsRemove only when stopped playing.

This commit is contained in:
Stiffly
2014-05-27 00:36:54 +02:00
parent f4cd50b741
commit 3b96be2162
7 changed files with 104 additions and 80 deletions
+15 -31
View File
@@ -54,19 +54,7 @@ void GameWorld::Initialize()
auto cameraComp = AddComponent<Components::Camera>(camera);
cameraComp->FarClip = 2000.f;
auto freeSteering = AddComponent<Components::FreeSteering>(camera);
{
auto se1 = CreateEntity(camera);
auto transform = AddComponent<Components::Transform>(se1);
transform->Position = glm::vec3(0,10,0);
transform->Scale = glm::vec3(3);
auto emitterComponent = AddComponent<Components::SoundEmitter>(se1);
emitterComponent->Path = "Sounds/WUB.mp3";
emitterComponent->MinDistance = 1.f;
emitterComponent->MaxDistance = 10000.f;
emitterComponent->Gain = 1;
// auto model = AddComponent<Components::Model>(se1);
// model->ModelFile = "Models/PlaceHolders/PhysicsTest/PointLight.obj";
}
}
CommitEntity(camera);
@@ -1155,24 +1143,20 @@ void GameWorld::Initialize()
}
}*/
// {
//
// }
//
// {
// auto se2 = CreateEntity();
// auto transform = AddComponent<Components::Transform>(se2);
// transform->Position = glm::vec3(100,10,0);
// transform->Scale = glm::vec3(3);
// auto emitterComponent = AddComponent<Components::SoundEmitter>(se2);
// emitterComponent->Path = "Sounds/DarkHorse.mp3";
// emitterComponent->Gain = 1;
// emitterComponent->MinDistance = 1.f;
// emitterComponent->MaxDistance = 50.f;
// auto model = AddComponent<Components::Model>(se2);
// model->ModelFile = "Models/PlaceHolders/PhysicsTest/PointLight.obj";
// CommitEntity(se2);
// }
{
auto se1 = CreateEntity();
auto transform = AddComponent<Components::Transform>(se1);
transform->Position = glm::vec3(0,-30,0);
transform->Scale = glm::vec3(3);
auto emitterComponent = AddComponent<Components::SoundEmitter>(se1);
emitterComponent->Path = "Sounds/WUB.mp3";
emitterComponent->MinDistance = 100.f;
emitterComponent->MaxDistance = 1000.f;
emitterComponent->Gain = 1;
auto model = AddComponent<Components::Model>(se1);
model->ModelFile = "Models/PlaceHolders/PhysicsTest/PointLight.obj";
}
/*for (int x = 0; x < 5; x++)