25 lines
462 B
C++
25 lines
462 B
C++
#pragma once
|
|
|
|
struct MovePathPoint
|
|
{
|
|
Vector2D pos;
|
|
float distance = 0.0;
|
|
};
|
|
|
|
class Entity;
|
|
class MovementComponent
|
|
{
|
|
public:
|
|
Entity* owner = nullptr;
|
|
|
|
virtual void Update(int delta_time);
|
|
bool GetMovePosition(int delta_time, Vector2D& out_pos);
|
|
void AddPathPoint(Vector2D& pos, float distance, float speed);
|
|
void ClearPath();
|
|
|
|
private:
|
|
float move_speed_ = 0.0f;
|
|
int path_index_ = 0;
|
|
std::vector<MovePathPoint> paths_;
|
|
};
|