//
//  Particle.hpp
//  Meteor
//
//  Created by Cesar Parent on 02/09/2015.
//  Copyright © 2015 Cesar Parent. All rights reserved.
//

#ifndef Particle_hpp
#define Particle_hpp

#include "../defines.h"
#include "../Geometry.h"
#include "../Graphics.h"

NS_BEGIN

class Particle {
    
public:
    
    friend class EmitterNode;
    
    virtual ~Particle() {}
    
    Particle();
    
private:
    
    void
    init(double lifetime);
    
    bool
    update(double delta, const vec2& emitter);
    
    bool
    done() const { return _elapsed >= _lifetime; }
    
    
    vec2        position;
    vec2        speed;
    vec2        gravity;
    vec2        acceleration;
    
    float       radialAccel;
    float       tangentAccel;
    
    float       rotation;
    float       rotationSpeed;
    
    Color       color;
    Color       colorRamp;
    
    float       scale;
    float       scaleSpeed;
    
    float       alpha;
    
    Particle*   next;
    
    double      _lifetime;
    double      _elapsed;
    
};


NS_END

#endif /* Particle_hpp */
