diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-04-24 15:35:35 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-04-24 15:41:43 (GMT) |
commit | c3290381a1dba7971dd70b7220a71e6feceb3f4c (patch) | |
tree | 136f68ab9da00b4571118f18875b3d53928eee46 /examples/statemachine/errorstate/tank.h | |
parent | dfe6974c1e7103ad46fa1162d7c9fd6a426894b7 (diff) | |
download | Qt-c3290381a1dba7971dd70b7220a71e6feceb3f4c.zip Qt-c3290381a1dba7971dd70b7220a71e6feceb3f4c.tar.gz Qt-c3290381a1dba7971dd70b7220a71e6feceb3f4c.tar.bz2 |
Unfinished tank AI game. The idea is that you plug in AIs for the tanks, and
one such plugin will have a run time error, so the game server needs to use
errorState for handling errors.
Diffstat (limited to 'examples/statemachine/errorstate/tank.h')
-rw-r--r-- | examples/statemachine/errorstate/tank.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/statemachine/errorstate/tank.h b/examples/statemachine/errorstate/tank.h new file mode 100644 index 0000000..9def6df --- /dev/null +++ b/examples/statemachine/errorstate/tank.h @@ -0,0 +1,31 @@ +#ifndef TANK_H +#define TANK_H + +#include <QObject> +#include <QLineF> + +class Tank: public QObject +{ + Q_OBJECT + Q_PROPERTY(qreal direction READ direction) + Q_PROPERTY(qreal distanceToObstacle READ distanceToObstacle) +public: + Tank(QObject *parent = 0) : QObject(parent) {} + + virtual qreal direction() const = 0; + virtual qreal distanceToObstacle() const = 0; + +signals: + void collision(const QLineF &collidedLine) const; + void actionCompleted(); + void tankSpotted(qreal otherTankDirection, qreal distance); + +public slots: + virtual void moveForwards(qreal length) = 0; + virtual void moveBackwards(qreal length) = 0; + virtual void turn(qreal newDirection) = 0; + virtual void stop() = 0; + virtual void fireCannon(qreal distance) = 0; +}; + +#endif |