#ifndef ACTOR_H #define ACTOR_H #include "gameentity.h" #include "constants.h" #include "audio.h" #include #include #include 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(); const QString iconStr(); Movement direction(); void setDirection(Movement direction); void reset(); bool hadReset(); bool isLocal(); void move(Movement direction); void move(QPoint newpos); bool isMoving(); void die(); void eatingFruit(); void eatingPacman(); void startEating(); void stopEating(); bool canEat(Actor *other, const QList &order); virtual void onDie(Actor *); unsigned int getRoundPoints(); unsigned int getGamePoints(); void addRoundPoints(unsigned int amount); void finishRound(bool died = false); static QPoint movementToPoint(const 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; bool m_reset; GaplessAudioPlayer *m_wakaPlayer; unsigned int m_roundPoints; unsigned int m_gamePoints; QList m_images; QList m_eating; QParallelAnimationGroup *m_moving; QSequentialAnimationGroup *m_dieing; }; #endif // ACTOR_H