-
Notifications
You must be signed in to change notification settings - Fork 4
/
weaponBase.h
73 lines (55 loc) · 1.4 KB
/
weaponBase.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
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef WEAPONBASE_H
#define WEAPONBASE_H
#include <QObject>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QTimer>
#include <QSoundEffect>
#include <QUrl>
#include "player.h"
class WeaponBase : public QObject, public QGraphicsPixmapItem
{
Q_OBJECT
public:
explicit WeaponBase(Player *pl, QGraphicsScene *scene, QObject *parent = nullptr);
void updatePos();
void rotateToCursor(const QPointF& target);
void setFireRateBoost(qreal fr);
void setDamageBoost(qreal dmg);
void setSpeedBoost(qreal sp);
virtual void fire() = 0;
void load();
void fire_on();
void fire_off();
// 数据接口
qreal getFireRateBoost();
qreal getDamageBoost();
qreal getSpeedBoost();
static QTimer *m_timer;
int getRoundBoost() const;
void setRoundBoost(int newRound_boost);
qreal getSpread() const;
void setSpread(qreal newSpread);
int getPenetration() const;
void setPenetration(int newPenetration);
bool getBarrage() const;
void setBarrage(bool newBarrage);
signals:
protected:
QGraphicsScene *m_scene;
Player *m_player;
qreal fire_rate_boost;
qreal damage_boost;
qreal speed_boost;
int round_boost;
qreal spread;
int penetration;
bool barrage;
QPixmap pix;
int fire_count;
bool is_fire;
// 音效
QSoundEffect *sfx_fire;
};
#endif // WEAPONBASE_H