-
Notifications
You must be signed in to change notification settings - Fork 1
/
units.h
61 lines (53 loc) · 1.42 KB
/
units.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef UNITS_H
#define UNITS_H
#include <QObject>
#include <QLabel>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QPainter>
#include <queue>
#include <QGraphicsSceneMouseEvent>
#include <QTimer>
#include "interface.h"
//#include <QRandomGenerator>
class Unit : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
explicit Unit(QObject *parent, int _startPos, QString _type, QVector<QPointF> &_path, QVector<Interface *>& _interfaces);
~Unit();
void moveTo(QPointF point);
int startPos;
int currentPos = 0;
int damage;
int reloading = 0;
int cooldown;
int maxHP;
int hp;
qreal initialSpeed;
int attackBaseValue;
bool isBlocked;
int currentFrame = 0;
bool slowedDown = false;
int slowingDown = 0;
int slowTimer;
bool deleted = false;
int income;
bool clicked = false;
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
QVector<QPointF> &path;
qreal dx = 0;
//public slots:
// void completePath();
protected:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option = nullptr, QWidget *widget = nullptr);
private:
QVector<Interface *> &interfaces;
// int offset;
QString type;
qreal speed;
QPixmap *spriteImage;
};
#endif // UNITS_H