#ifndef SPIN_AI_H #define SPIN_AI_H #include #include #include #include class SpinState: public QState { Q_OBJECT public: SpinState(Tank *tank, QState *parent) : QState(parent), m_tank(tank) { } public slots: void spin() { m_tank->turn(90.0); } protected: void onEntry() { connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); spin(); } private: Tank *m_tank; }; class SpinAi: public QObject, public Plugin { Q_OBJECT Q_INTERFACES(Plugin) public: virtual QState *create(QState *parentState, Tank *tank); }; #endif