From a9a19193ad18c4be8149c08651988d0bd2ea2dcc Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 2 Mar 2016 17:21:15 +0100 Subject: [PATCH 1/5] Component for Boost icons --- resources/Schema/Components.xsd | 1 + resources/Schema/Components/BoostIconsHUD.xml | 2 ++ resources/Schema/Components/BoostIconsHUD.xsd | 10 ++++++++++ resources/Schema/Types/Entity.xsd | 1 + 4 files changed, 14 insertions(+) create mode 100644 resources/Schema/Components/BoostIconsHUD.xml create mode 100644 resources/Schema/Components/BoostIconsHUD.xsd diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index a75de84e..f0fb52d3 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -56,4 +56,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/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 61d8e520..94183c75 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -53,6 +53,7 @@ + From 8b66d29adcb75311b27c4c98480f4dcf3145a406 Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 2 Mar 2016 17:32:45 +0100 Subject: [PATCH 2/5] Skeleton system for Boost icons --- include/Game/Systems/BoostIconsHUDSystem.h | 17 +++++++++++++++++ src/Game/Game.cpp | 2 ++ src/Game/Systems/BoostIconsHUDSystem.cpp | 6 ++++++ 3 files changed, 25 insertions(+) create mode 100644 include/Game/Systems/BoostIconsHUDSystem.h create mode 100644 src/Game/Systems/BoostIconsHUDSystem.cpp diff --git a/include/Game/Systems/BoostIconsHUDSystem.h b/include/Game/Systems/BoostIconsHUDSystem.h new file mode 100644 index 00000000..fbcdfc16 --- /dev/null +++ b/include/Game/Systems/BoostIconsHUDSystem.h @@ -0,0 +1,17 @@ +#ifndef BoostIconsHUDSystem_h__ +#define BoostIconsHUDSystem_h__ + +#include "../../Engine/Core/System.h" +#include "../../Engine/GLM.h" + +class BoostIconsHUDSystem : public ImpureSystem +{ +public: + BoostIconsHUDSystem(SystemParams params) + : System(params) + { } + + virtual void Update(double dt) override; +}; + +#endif \ No newline at end of file diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 8c6e653e..c3f1e439 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -28,6 +28,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" @@ -146,6 +147,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..6d181233 --- /dev/null +++ b/src/Game/Systems/BoostIconsHUDSystem.cpp @@ -0,0 +1,6 @@ +#include "Game/Systems/BoostIconsHUDSystem.h" + +void BoostIconsHUDSystem::Update(double dt) +{ + //Logic here +} From 7af17049e9489a0df32418da8dfe994c75c862dc Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 2 Mar 2016 18:13:09 +0100 Subject: [PATCH 3/5] BoostIcons should now track correctly --- include/Game/Systems/BoostIconsHUDSystem.h | 6 ++-- src/Game/Systems/BoostIconsHUDSystem.cpp | 40 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/include/Game/Systems/BoostIconsHUDSystem.h b/include/Game/Systems/BoostIconsHUDSystem.h index fbcdfc16..d8de777d 100644 --- a/include/Game/Systems/BoostIconsHUDSystem.h +++ b/include/Game/Systems/BoostIconsHUDSystem.h @@ -4,14 +4,16 @@ #include "../../Engine/Core/System.h" #include "../../Engine/GLM.h" -class BoostIconsHUDSystem : public ImpureSystem +class BoostIconsHUDSystem : public PureSystem { public: BoostIconsHUDSystem(SystemParams params) : System(params) + , PureSystem("BoostIconsHUD") { } - virtual void Update(double dt) override; + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override; + }; #endif \ No newline at end of file diff --git a/src/Game/Systems/BoostIconsHUDSystem.cpp b/src/Game/Systems/BoostIconsHUDSystem.cpp index 6d181233..f83278ff 100644 --- a/src/Game/Systems/BoostIconsHUDSystem.cpp +++ b/src/Game/Systems/BoostIconsHUDSystem.cpp @@ -1,6 +1,42 @@ #include "Game/Systems/BoostIconsHUDSystem.h" -void BoostIconsHUDSystem::Update(double dt) +void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) { - //Logic here + 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; + } + } + } } + From 8b81ba9019b566ccca5315a5c6cea3b14f7cb15d Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 2 Mar 2016 21:40:20 +0100 Subject: [PATCH 4/5] Some small fixes, also added new UI elements to Player --- resources/Schema/Components/Text.xml | 2 +- resources/Schema/Entities/Player.xml | 93 ++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 6 deletions(-) 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 28ace561..9fb563f8 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -132,7 +132,70 @@ - + + + + + + + + + + + + + + Textures/Core/White.png + false + + + + + + + + + + + + + + + + + Textures/Core/White.png + false + + + + + + + + + + + + + + + + + Textures/Core/White.png + false + + + + + + + + + + + + + @@ -196,7 +259,6 @@ 3 - 0.80222018197612788 @@ -231,6 +293,7 @@ 4 + 1 @@ -286,7 +349,7 @@ Textures/Core/UnitHexagon.png - + @@ -297,7 +360,8 @@ - + 1 + Textures/Core/UnitHexagon_Rotated.png @@ -306,7 +370,7 @@ - + @@ -369,6 +433,25 @@ + + + + + Models/Widgets/Arrows/Arrow9.mesh + + + + + + + + + + + + + + From 2d438060ddc5e396aa96b9c94e8ab60839c51911 Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 2 Mar 2016 22:08:23 +0100 Subject: [PATCH 5/5] Player arrow change --- resources/Schema/Entities/Player.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 9fb563f8..34692605 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -100,12 +100,12 @@ 1 - 100/100 Fonts/DroidSans.ttf,64 + @@ -437,7 +437,7 @@ - Models/Widgets/Arrows/Arrow9.mesh + Models/Widgets/Arrows/Arrow5.mesh @@ -447,7 +447,7 @@ - +