diff --git a/include/Game/Systems/BoostIconsHUDSystem.h b/include/Game/Systems/BoostIconsHUDSystem.h new file mode 100644 index 00000000..d8de777d --- /dev/null +++ b/include/Game/Systems/BoostIconsHUDSystem.h @@ -0,0 +1,19 @@ +#ifndef BoostIconsHUDSystem_h__ +#define BoostIconsHUDSystem_h__ + +#include "../../Engine/Core/System.h" +#include "../../Engine/GLM.h" + +class BoostIconsHUDSystem : public PureSystem +{ +public: + BoostIconsHUDSystem(SystemParams params) + : System(params) + , PureSystem("BoostIconsHUD") + { } + + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override; + +}; + +#endif \ No newline at end of file diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index 62cb32b6..004a11a7 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -58,4 +58,5 @@ + \ No newline at end of file diff --git a/resources/Schema/Components/BoostIconsHUD.xml b/resources/Schema/Components/BoostIconsHUD.xml new file mode 100644 index 00000000..e25d9611 --- /dev/null +++ b/resources/Schema/Components/BoostIconsHUD.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/Schema/Components/BoostIconsHUD.xsd b/resources/Schema/Components/BoostIconsHUD.xsd new file mode 100644 index 00000000..c5fe2e5d --- /dev/null +++ b/resources/Schema/Components/BoostIconsHUD.xsd @@ -0,0 +1,10 @@ + + + + + + + Origin for the 3 boost states. Create 3 children with Sprite and Fill components, name them "Sprint", "Defender", "Assault" + + + \ No newline at end of file diff --git a/resources/Schema/Components/Text.xml b/resources/Schema/Components/Text.xml index d38d3961..cda29b86 100644 --- a/resources/Schema/Components/Text.xml +++ b/resources/Schema/Components/Text.xml @@ -1,7 +1,7 @@ - + Fonts/DroidSans.ttf,64 true
diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 91b25bcb..34692605 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -12,7 +12,6 @@ - 52.867678870419283 @@ -101,12 +100,12 @@ 1 - 100/100 Fonts/DroidSans.ttf,64 + @@ -123,7 +122,6 @@ Textures/HealthHUD3.png - false @@ -135,34 +133,62 @@ - + - - - - - - Textures/Core/White.png - false - - - - - - - + + - + - - 0.0 - Fonts/DroidSans.ttf,64 - - + + + + + Textures/Core/White.png + false + + + - - + + + + + + + + + + + + + Textures/Core/White.png + false + + + + + + + + + + + + + + + + + Textures/Core/White.png + false + + + + + + @@ -233,7 +259,6 @@ 3 - 0.80222018197612788 @@ -268,6 +293,7 @@ 4 + 1 @@ -323,7 +349,7 @@ Textures/Core/UnitHexagon.png - + @@ -334,7 +360,8 @@ - + 1 + Textures/Core/UnitHexagon_Rotated.png @@ -343,7 +370,7 @@ - + @@ -406,6 +433,25 @@ + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 49c669ab..1d8ea8f3 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -54,6 +54,7 @@ + diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index fc2ebabb..ab4b9652 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -31,6 +31,7 @@ #include "Game/Systems/CapturePointArrowHUDSystem.h" #include "Game/Systems/KillFeedSystem.h" #include "Game/Systems/BoostSystem.h" +#include "Game/Systems/BoostIconsHUDSystem.h" #include "GUI/ButtonSystem.h" #include "GUI/MainMenuSystem.h" @@ -149,6 +150,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); + m_SystemPipeline->AddSystem(updateOrderLevel); // Populate Octree with collidables ++updateOrderLevel; m_SystemPipeline->AddSystem(updateOrderLevel, m_OctreeCollision, "Collidable"); diff --git a/src/Game/Systems/BoostIconsHUDSystem.cpp b/src/Game/Systems/BoostIconsHUDSystem.cpp new file mode 100644 index 00000000..f83278ff --- /dev/null +++ b/src/Game/Systems/BoostIconsHUDSystem.cpp @@ -0,0 +1,42 @@ +#include "Game/Systems/BoostIconsHUDSystem.h" + +void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) +{ + EntityWrapper assaultEntity = entity.FirstChildByName("Assault"); + EntityWrapper defenderEntity = entity.FirstChildByName("Defender"); + EntityWrapper sniperEntity = entity.FirstChildByName("Sniper"); + + if(assaultEntity.Valid()) { + if (assaultEntity.HasComponent("Fill")) { + EntityWrapper parentWithAssaultBoost = assaultEntity.FirstParentWithComponent("BoostAssault"); + if (parentWithAssaultBoost.Valid()) { + (double&)assaultEntity["Fill"]["Percentage"] = 1.0; + } else { + (double&)assaultEntity["Fill"]["Percentage"] = 0.0; + } + } + } + + if (defenderEntity.Valid()) { + if (defenderEntity.HasComponent("Fill")) { + EntityWrapper parentWithAssaultBoost = defenderEntity.FirstParentWithComponent("BoostDefender"); + if (parentWithAssaultBoost.Valid()) { + (double&)defenderEntity["Fill"]["Percentage"] = 1.0; + } else { + (double&)defenderEntity["Fill"]["Percentage"] = 0.0; + } + } + } + + if (sniperEntity.Valid()) { + if (sniperEntity.HasComponent("Fill")) { + EntityWrapper parentWithAssaultBoost = sniperEntity.FirstParentWithComponent("BoostSniper"); + if (parentWithAssaultBoost.Valid()) { + (double&)sniperEntity["Fill"]["Percentage"] = 1.0; + } else { + (double&)sniperEntity["Fill"]["Percentage"] = 0.0; + } + } + } +} +