Merge branch 'master' into Dirtybit

# Conflicts:
#	include/Engine/Rendering/ExplosionEffectJob.h
#	src/Game/Systems/ExplosionEffectSystem.cpp
This commit is contained in:
William Moberg
2016-03-12 17:59:50 +01:00
16 changed files with 8401 additions and 8295 deletions
+10 -7
View File
@@ -7,12 +7,15 @@ void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrap
delay = std::max(0.0, delay - dt);
}
if (delay <= 0) {
Field<double> timeSinceDeath = component["TimeSinceDeath"];
timeSinceDeath += (Field<double>)component["Speed"] * dt;
if (timeSinceDeath < 0 || timeSinceDeath > (const double&)component["ExplosionDuration"]) {
timeSinceDeath = 0.0;
}
}
if (delay <= 0) {
Field<double> timeSinceDeath = component["TimeSinceDeath"];
timeSinceDeath += (Field<double>)component["Speed"] * dt;
if (timeSinceDeath < 0) {
timeSinceDeath = 0.0;
}
else if (timeSinceDeath >(const double&)component["ExplosionDuration"]) {
timeSinceDeath = (const double&)component["ExplosionDuration"];
}
}
}
+49 -12
View File
@@ -27,13 +27,15 @@ void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e)
//No submenu is open, open one.
for (auto& menu : *menus) {
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
if (!serverListSpawner.HasComponent("Spawner")) {
auto spawner = menuEntity.FirstChildByName(e.Command + "Spawner");
if (!spawner.HasComponent("Spawner")) {
return;
}
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
Events::SearchForServers event;
m_EventBroker->Publish(event);
m_OpenSubMenu = SpawnerSystem::Spawn(spawner, spawner);
if (e.Command == "Play") {
Events::SearchForServers event;
m_EventBroker->Publish(event);
}
break;
}
@@ -41,22 +43,53 @@ void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e)
//Menu is open, but not the right one, delete the old one and open a new one.
m_World->DeleteEntity(m_OpenSubMenu.ID);
m_OpenSubMenu = EntityWrapper::Invalid;
m_World->DeleteEntity(m_DropDown.ID);
m_DropDown = EntityWrapper::Invalid;
for (auto& menu : *menus) {
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
if (!serverListSpawner.HasComponent("Spawner")) {
auto Spawner = menuEntity.FirstChildByName(e.Command + "Spawner");
if (!Spawner.HasComponent("Spawner")) {
return;
}
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
Events::SearchForServers event;
m_EventBroker->Publish(event);
m_OpenSubMenu = SpawnerSystem::Spawn(Spawner, Spawner);
if(e.Command == "Play") {
Events::SearchForServers event;
m_EventBroker->Publish(event);
}
break;
}
} else {
//Serverlist submenu is open, close it.
//wanted submenu is open, close it.
m_World->DeleteEntity(m_OpenSubMenu.ID);
m_OpenSubMenu = EntityWrapper::Invalid;
m_World->DeleteEntity(m_DropDown.ID);
m_DropDown = EntityWrapper::Invalid;
}
}
void MainMenuSystem::OpenDropDown(const Events::InputCommand& e)
{
auto menus = m_World->GetComponents("Menu");
if (menus == nullptr) {
return;
}
if (m_DropDown == EntityWrapper::Invalid) {
//No submenu is open, open one.
for (auto& menu : *menus) {
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
auto spawner = menuEntity.FirstChildByName(e.Command + "Spawner");
if (!spawner.HasComponent("Spawner")) {
return;
}
m_DropDown = SpawnerSystem::Spawn(spawner, spawner);
break;
}
} else {
m_World->DeleteEntity(m_DropDown.ID);
m_DropDown = EntityWrapper::Invalid;
}
}
@@ -73,8 +106,10 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
m_EventBroker->Publish(event);
}
} else if (entity.HasComponent("ConfigBtnResolution")) {
m_Renderer->SetResolution(Rectangle((int)entity["ConfigBtnResolution"]["Width"], (int)entity["ConfigBtnResolution"]["Height"]));
m_World->DeleteEntity(m_DropDown.ID);
m_DropDown = EntityWrapper::Invalid;
}
return true;
}
@@ -98,6 +133,8 @@ bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
m_EventBroker->Publish(event);
} else if (e.Command == "Options" && e.Value == 1) {
OpenSubMenu(e);
} else if (e.Command == "Resolution" && e.Value == 1) {
OpenDropDown(e);
}
return true;
}