StartMenu system now sets the main menu camera to active as long as it exists.

This commit is contained in:
Tleety
2016-03-09 15:29:42 +01:00
parent a76a04260f
commit 49040e9c4b
4 changed files with 36 additions and 4 deletions
+26 -1
View File
@@ -4,5 +4,30 @@ StartSystem::StartSystem(SystemParams params)
: System(params)
, ImpureSystem()
{
EVENT_SUBSCRIBE_MEMBER(m_ECameraActivated, &StartSystem::OnCameraActivated);
}
}
void StartSystem::Update(double dt)
{
auto cameras = m_World->GetComponents("Camera");
if(cameras == nullptr) {
return;
}
for(auto& cCamera: *cameras) {
EntityWrapper cameraEntity = EntityWrapper(m_World, cCamera.EntityID);
if(cameraEntity == m_activeCamera){
return;
}
if(cameraEntity.Name() == "Overview_Camera_Start_Menu") {
Events::SetCamera event;
event.CameraEntity = cameraEntity;
m_EventBroker->Publish(event);
}
}
}
bool StartSystem::OnCameraActivated(const Events::SetCamera& e)
{
m_activeCamera = e.CameraEntity;
return 1;
}