BoostIcons should now track correctly
This commit is contained in:
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user