#include "BloodGenerator.h"

#include <math.h>
#include <stdlib.h>

#include "MemoryManager/DebugNew.h"


using namespace ParticleSystem;

BloodGenerator::BloodGenerator(float x, float y, float z){
	direction[0] = x;
	direction[1] = y;
	direction[2] = z;
	maxGeneration = 6;
	this->generationDelay = 0.003f;
	this->previousTime = 0;
	loop = false;
}

BloodGenerator::~BloodGenerator(void){
}

void BloodGenerator::generate(ParticleEngine::Particle * particle){
	if (canGenerate()){
		
		particle->pos[0] = pos[0];
		particle->pos[1] = pos[1];
		particle->pos[2] = pos[2];
		particle->direction[0] = cos((float)rand());
		particle->direction[1] = fabs(cos((float)rand()))*5;
		particle->direction[2] = cos((float)rand());
		particle->life = 0;
		particle->maxLife = cos((float)rand())*0.5f + 2.0f;
		particle->beginCouleur[0] = 1.0f;
		particle->beginCouleur[1] = 1.0f;
		particle->beginCouleur[2] = 1.0f;
		particle->beginCouleur[3] = 1.0f;
		particle->endCouleur[0] = 1.0f;
		particle->endCouleur[1] = 1.0f;
		particle->endCouleur[2] = 1.0f;
		particle->endCouleur[3] = 0.1f;
		particle->masse = 10.0f;
		particle->size = 1;
		generation++;
	}

}

