~mpredotka/machines-vs-machines/level-backgrounds-sand

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef FIELD_H
#define FIELD_H

#include <QObject>

class Tower;
class Engine;

class Field : public QObject
{
    Q_OBJECT
    Q_PROPERTY(int x READ x CONSTANT)
    Q_PROPERTY(int y READ y CONSTANT)

    Q_PROPERTY(bool isOnPath READ isOnPath CONSTANT)
    Q_PROPERTY(bool allowedForEnenmy READ allowedForEnemy CONSTANT)
    Q_PROPERTY(QString color READ color CONSTANT)
    Q_PROPERTY(Tower* tower READ tower NOTIFY towerChanged)

public:
    explicit Field(Engine *engine, int x, int y, QObject *parent = 0);

    int x() const;
    int y() const;

    bool isOnPath() const;
    void setIsOnPath(bool isOnPath);

    bool allowedForEnemy() const;

    QString color() const;
    void setColor(const QString &color);

    Tower* tower() const;

    void addTower(Tower *tower);
    void destroyTower();

signals:
    void towerChanged();

private:
    Engine *m_engine;
    int m_x;
    int m_y;
    QString m_color;
    bool m_isOnPath;
    Tower *m_tower;
};

#endif // FIELD_H