blob: 389d7c615978a5adc842c9defadf4f50ad4b28a5 (
plain)
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
74
|
#ifndef ACTOR_H
#define ACTOR_H
#include "gameentity.h"
#include "constants.h"
#include "audio.h"
#include <QtCore/QSequentialAnimationGroup>
#include <QtCore/QParallelAnimationGroup>
#include <QList>
class Actor
: public GameEntity
{
Q_OBJECT
public:
enum Movement
{
None = 0,
Left,
Right,
Up,
Down,
};
enum
{
Type = UserType + Transmission::pacman
};
Actor(Color::Color color, bool local = false, QGraphicsItem *parent = 0);
virtual ~Actor()
{};
PixmapItem &icon();
Movement direction();
void resetDirection();
bool isLocal();
void move(Movement direction);
bool isMoving();
void die();
void eatingFruit();
void eatingPacman();
void startEating();
void stopEating();
bool canEat(Actor *other, const QList<Color::Color> &order);
unsigned int getRoundPoints();
unsigned int getGamePoints();
void addRoundPoints(unsigned int amount);
void finishRound();
static QPoint movementToPoint(const Actor::Movement direction);
private:
void moveByServer(Movement direction);
QSequentialAnimationGroup *setupEatingAnimation(Actor::Movement direction);
private:
QPixmap m_pix;
Movement m_direction;
PixmapItem m_icon;
bool m_local;
GaplessAudioPlayer *m_wakaPlayer;
unsigned int m_roundPoints;
unsigned int m_gamePoints;
QList<PixmapItem *> m_images;
QList<QSequentialAnimationGroup *> m_eating;
QParallelAnimationGroup *m_moving;
};
#endif // ACTOR_H
|