36 lines
743 B
C++
36 lines
743 B
C++
#pragma once
|
|
|
|
#include "ZLMath.h"
|
|
#include "Renderer.h"
|
|
#include "TextureManager.h"
|
|
#include <memory>
|
|
|
|
namespace ZL {
|
|
|
|
class Projectile {
|
|
public:
|
|
Projectile();
|
|
~Projectile() = default;
|
|
|
|
void init(const Vector3f& startPos, const Vector3f& startVel, float lifeMs, float size, std::shared_ptr<Texture> tex, Renderer& renderer);
|
|
void update(float deltaMs, Renderer& renderer);
|
|
void draw(Renderer& renderer) const;
|
|
|
|
bool isActive() const { return active; }
|
|
|
|
Vector3f getPosition() const { return pos; }
|
|
|
|
private:
|
|
Vector3f pos;
|
|
Vector3f vel;
|
|
float life;
|
|
float maxLife;
|
|
bool active;
|
|
float size;
|
|
VertexRenderStruct mesh;
|
|
std::shared_ptr<Texture> texture;
|
|
|
|
void rebuildMesh(Renderer& renderer);
|
|
};
|
|
|
|
} // namespace ZL
|