50 lines
993 B
C++
50 lines
993 B
C++
#pragma once
|
|
|
|
#include "render/Renderer.h"
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
namespace FRG {
|
|
|
|
class Character;
|
|
|
|
class PathVisualization
|
|
{
|
|
public:
|
|
enum class Style {
|
|
Movement,
|
|
Hostile,
|
|
Teleport
|
|
};
|
|
|
|
void initialize();
|
|
void setEnabled(bool enabled);
|
|
bool isEnabled() const { return enabled; }
|
|
|
|
void start(const Character& player, const Eigen::Vector3f& clickedDestination,
|
|
Style style = Style::Movement);
|
|
void cancel();
|
|
void update(int64_t deltaMs);
|
|
void draw(Renderer& renderer);
|
|
|
|
private:
|
|
struct Dot {
|
|
Eigen::Vector3f position = Eigen::Vector3f::Zero();
|
|
float delayMs = 0.0f;
|
|
float lifetimeMs = 0.0f;
|
|
};
|
|
|
|
bool enabled = true;
|
|
bool active = false;
|
|
float elapsedMs = 0.0f;
|
|
float durationMs = 0.0f;
|
|
Eigen::Vector3f destination = Eigen::Vector3f::Zero();
|
|
Eigen::Vector3f color = Eigen::Vector3f(0.08f, 1.0f, 0.25f);
|
|
std::vector<Dot> dots;
|
|
VertexRenderStruct dotMesh;
|
|
VertexRenderStruct destinationMesh;
|
|
};
|
|
|
|
} // namespace FRG
|