From 7d15313209e7ef79893828f22616a8c146fb4a09 Mon Sep 17 00:00:00 2001 From: antc13 Date: Wed, 2 Mar 2016 17:22:44 +0100 Subject: [PATCH] Added a FloatingEffectSystem to the game. Pickups now move up and down, if so desired. --- include/Game/Systems/FloatingEffectSystem.h | 20 +++ resources/Schema/Components.xsd | 1 + .../Schema/Components/FloatingEffect.xml | 7 + .../Schema/Components/FloatingEffect.xsd | 17 ++ resources/Schema/Entities/NewMap2version2.xml | 98 ++++++------ .../Schema/Entities/NewMap2version3NEW.xml | 148 ++++++++++++++---- src/Game/Game.cpp | 2 + 7 files changed, 210 insertions(+), 83 deletions(-) create mode 100644 include/Game/Systems/FloatingEffectSystem.h create mode 100644 resources/Schema/Components/FloatingEffect.xml create mode 100644 resources/Schema/Components/FloatingEffect.xsd diff --git a/include/Game/Systems/FloatingEffectSystem.h b/include/Game/Systems/FloatingEffectSystem.h new file mode 100644 index 00000000..2462e029 --- /dev/null +++ b/include/Game/Systems/FloatingEffectSystem.h @@ -0,0 +1,20 @@ +#include "Common.h" +#include "Core/System.h" + +class FloatingEffectSystem : public PureSystem +{ +public: + FloatingEffectSystem(SystemParams params) + : System(params) + , PureSystem("FloatingEffect") + { } + + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override + { + ComponentWrapper& transform = m_World->GetComponent(component.EntityID, "Transform"); + (double&)component["Time"] += dt; + //(double)component["Amplitude"] * glm::sin((glm::two_pi() / (double)component["Period"]) * (double)component["Time"]); + (glm::vec3&)transform["Position"] = (float)(double)component["Amplitude"] * glm::sin((glm::two_pi() / (float)(double)component["Period"]) * (float)(double)component["Time"]) * (glm::vec3)component["Axis"]; + + } +}; \ No newline at end of file diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index a75de84e..fccfd3d0 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/FloatingEffect.xml b/resources/Schema/Components/FloatingEffect.xml new file mode 100644 index 00000000..661e4ae4 --- /dev/null +++ b/resources/Schema/Components/FloatingEffect.xml @@ -0,0 +1,7 @@ + + + 1 + 1 + + + \ No newline at end of file diff --git a/resources/Schema/Components/FloatingEffect.xsd b/resources/Schema/Components/FloatingEffect.xsd new file mode 100644 index 00000000..a71006f5 --- /dev/null +++ b/resources/Schema/Components/FloatingEffect.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/Schema/Entities/NewMap2version2.xml b/resources/Schema/Entities/NewMap2version2.xml index fcb81666..8089073f 100644 --- a/resources/Schema/Entities/NewMap2version2.xml +++ b/resources/Schema/Entities/NewMap2version2.xml @@ -804,11 +804,11 @@ - + 2 - + @@ -825,7 +825,7 @@ - + @@ -851,11 +851,11 @@ - + 2 - + @@ -872,7 +872,7 @@ - + @@ -898,11 +898,11 @@ - + 2 - + @@ -919,7 +919,7 @@ - + @@ -945,11 +945,11 @@ - + 2 - + @@ -966,7 +966,7 @@ - + @@ -992,11 +992,11 @@ - + 2 - + @@ -1013,7 +1013,7 @@ - + @@ -1039,11 +1039,11 @@ - + 2 - + @@ -1060,7 +1060,7 @@ - + @@ -1086,11 +1086,11 @@ - + 2 - + @@ -1107,7 +1107,7 @@ - + @@ -2242,7 +2242,7 @@ Models/Props/Stones/AssaultHolder.mesh - + @@ -2355,11 +2355,11 @@ - + 2 - + @@ -2376,7 +2376,7 @@ - + @@ -2402,11 +2402,11 @@ - + 2 - + @@ -2423,7 +2423,7 @@ - + @@ -2904,11 +2904,11 @@ - + 2 - + @@ -2925,7 +2925,7 @@ - + @@ -2951,11 +2951,11 @@ - + 2 - + @@ -2972,7 +2972,7 @@ - + @@ -2998,11 +2998,11 @@ - + 2 - + @@ -3019,7 +3019,7 @@ - + @@ -3045,11 +3045,11 @@ - + 2 - + @@ -3066,7 +3066,7 @@ - + @@ -3092,11 +3092,11 @@ - + 2 - + @@ -3113,7 +3113,7 @@ - + @@ -3139,11 +3139,11 @@ - + 2 - + @@ -3160,7 +3160,7 @@ - + @@ -3186,11 +3186,11 @@ - + 2 - + @@ -3207,7 +3207,7 @@ - + diff --git a/resources/Schema/Entities/NewMap2version3NEW.xml b/resources/Schema/Entities/NewMap2version3NEW.xml index 5b224de3..61e7b740 100644 --- a/resources/Schema/Entities/NewMap2version3NEW.xml +++ b/resources/Schema/Entities/NewMap2version3NEW.xml @@ -802,8 +802,13 @@ + + + + 2 + - + @@ -821,7 +826,7 @@ - + @@ -844,8 +849,13 @@ + + + + 2 + - + @@ -863,7 +873,7 @@ - + @@ -886,8 +896,13 @@ + + + + 2 + - + @@ -905,7 +920,7 @@ - + @@ -928,8 +943,13 @@ + + + + 2 + - + @@ -947,7 +967,7 @@ - + @@ -970,8 +990,13 @@ + + + + 2 + - + @@ -989,7 +1014,7 @@ - + @@ -1012,8 +1037,13 @@ + + + + 2 + - + @@ -1031,7 +1061,7 @@ - + @@ -1054,8 +1084,13 @@ + + + + 2 + - + @@ -1073,7 +1108,7 @@ - + @@ -2318,8 +2353,13 @@ + + + + 2 + - + @@ -2337,7 +2377,7 @@ - + @@ -2360,8 +2400,13 @@ + + + + 2 + - + @@ -2379,7 +2424,7 @@ - + @@ -2857,8 +2902,13 @@ + + + + 2 + - + @@ -2876,7 +2926,7 @@ - + @@ -2899,8 +2949,13 @@ + + + + 2 + - + @@ -2918,7 +2973,7 @@ - + @@ -2941,8 +2996,13 @@ + + + + 2 + - + @@ -2960,7 +3020,7 @@ - + @@ -2983,8 +3043,13 @@ + + + + 2 + - + @@ -3002,7 +3067,7 @@ - + @@ -3025,8 +3090,13 @@ + + + + 2 + - + @@ -3044,7 +3114,7 @@ - + @@ -3067,8 +3137,13 @@ + + + + 2 + - + @@ -3086,7 +3161,7 @@ - + @@ -3109,8 +3184,13 @@ + + + + 2 + - + @@ -3128,7 +3208,7 @@ - + @@ -4222,7 +4302,7 @@ - -15 + -15 4 @@ -4444,7 +4524,7 @@ - 1 + 0.40000000596046448 diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 8c6e653e..b4c1a71d 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -10,6 +10,7 @@ #include "Systems/SpawnerSystem.h" #include "Systems/PlayerSpawnSystem.h" #include "Systems/PlayerDeathSystem.h" +#include "Systems/FloatingEffectSystem.h" #include "Core/EntityFileWriter.h" #include "Game/Systems/CapturePointSystem.h" #include "Game/Systems/CapturePointHUDSystem.h" @@ -120,6 +121,7 @@ Game::Game(int argc, char* argv[]) ++updateOrderLevel; m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); + m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel);