summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/errorstate/tank.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/statemachine/errorstate/tank.h')
-rw-r--r--examples/statemachine/errorstate/tank.h31
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