#include "effectManager.h"
+#include "Effects/Effect.h"
#include "Effects/Gravity.h"
-Gravity* g = new Gravity();
+/// ***** Private Variables *****
+Effect** effects;
+int numEffects;
+
+/// ***** Public Methods *****
+
+void effect::init()
+{
+ numEffects = 1;
+ effects = new Effect*[numEffects]();
+
+ effects[0] = new Gravity();
+}
+void effect::clean()
+{
+ for(int i=0; i < numEffects; i++)
+ {
+ delete effects[i];
+ }
+
+ delete effects;
+}
Vector2 effect::positionDelta(const PhysicsEntity* e, float time_step)
{
- return g->positionDelta(e, time_step);
+ Vector2 acc(0,0);
+
+ for(int i=0; i < numEffects; i++)
+ {
+ acc += effects[i]->positionDelta(e, time_step);
+ }
+
+ return acc;
}
Vector2 effect::velocityDelta(const PhysicsEntity* e, float time_step)
{
- return g->velocityDelta(e, time_step);
+ Vector2 acc(0,0);
+
+ for(int i=0; i < numEffects; i++)
+ {
+ acc += effects[i]->velocityDelta(e, time_step);
+ }
+
+ return acc;
}
Vector2 effect::forceDelta(const PhysicsEntity* e, float time_step)
{
- return g->forceDelta(e, time_step);
+ Vector2 acc(0,0);
+
+ for(int i=0; i < numEffects; i++)
+ {
+ acc += effects[i]->forceDelta(e, time_step);
+ }
+
+ return acc;
}
/// ***** Header Methods *****
namespace effect
{
+ void init();
+ void clean();
+
Vector2 positionDelta(const PhysicsEntity*, float);
Vector2 velocityDelta(const PhysicsEntity*, float);
Vector2 forceDelta(const PhysicsEntity*, float);
using std::vector;
#include "entityCreator.h"
+#include "effectManager.h"
#include "GameStates/GameState.h"
#include "GameStates/Running.h"
active_States.push_back(running);
+ effect::init();
+
#ifdef DEBUGGING
cout << "World Created" << endl;
#endif
void gameClean()
{
+ effect::clean();
+
creator::clean();
delete creating_Polygon;