BoostIcons should now track correctly

This commit is contained in:
Tleety
2016-03-02 18:13:09 +01:00
parent 8b66d29adc
commit 7af17049e9
2 changed files with 42 additions and 4 deletions
+4 -2
View File
@@ -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
+38 -2
View File
@@ -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;
}
}
}
}