-
Notifications
You must be signed in to change notification settings - Fork 0
/
route.h
38 lines (32 loc) · 796 Bytes
/
route.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef ROUTE_H
#define ROUTE_H
#include <QPoint>
#include <QJsonObject>
class Route
{
public:
enum class Path {Line, Stay, Left, Right, Bottom, None, Lemniscate, Sin, Top, HalfCircleRightLeft};
explicit Route(class GameObject* object, Route::Path path, QPoint end);
explicit Route(class GameObject* object,Route::Path path);
Route() = default;
virtual ~Route() = default;
QPoint getNextPoint(double speed);
Route::Path getRoutePath();
bool isEnded();
void setTheEnd(bool);
void setStart();
void read(const QJsonObject &json);
void write(QJsonObject &json) const;
protected:
QPoint start;
QPoint end;
Route::Path path;
private:
QPoint position;
double dx;
double dy;
double q;
bool theEnd = false;
class GameObject* parent;
};
#endif // ROUTE_H