Added a FloatingEffectSystem to the game. Pickups now move up and down, if so desired.

This commit is contained in:
antc13
2016-03-02 17:22:44 +01:00
parent f8f4b4d939
commit 7d15313209
7 changed files with 210 additions and 83 deletions
@@ -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>() / (double)component["Period"]) * (double)component["Time"]);
(glm::vec3&)transform["Position"] = (float)(double)component["Amplitude"] * glm::sin((glm::two_pi<float>() / (float)(double)component["Period"]) * (float)(double)component["Time"]) * (glm::vec3)component["Axis"];
}
};