summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/errorstate/tank.h
blob: 49c5daf8f019743215d5901e70e9b732b01d369d (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
#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 degrees) = 0;
    virtual void stop() = 0;
    virtual void fireCannon() = 0;
};

#endif