Tower Defence 2
tower.h
1 #ifndef TOWER_DEFENCE_2_TOWER_H
2 #define TOWER_DEFENCE_2_TOWER_H
3 
4 #include "object.h"
5 #include <vector>
6 #include <string>
7 
8 
9 // Deferred declaration
10 class TowerType;
11 
13 class Tower : public Object {
14 public:
15  Tower(double x, double y, double radius, int damage, double attack_range,
16  double attack_speed, TowerType *tower_type);
17  ~Tower();
18 
19  TowerType *tower_type();
20 
21  Tower *upgrade(int index);
22 
23 private:
24  TowerType *m_tower_type;
25 };
26 
28 class TowerType {
29 public:
30  TowerType(const std::string &name, int cost, int damage,
31  double attack_range, double attack_speed);
32 
34  ~TowerType();
35 
36  std::string name() const;
37  const int cost() const;
38  const int damage() const;
39  std::vector<TowerType *> upgrade_options() const;
40  const double attack_range() const;
41  const double attack_speed() const;
42 
44  void add_upgrade_option(TowerType *tower_type);
45 
47  Tower * create_tower(double x, double y);
48 
49 private:
51  const std::string m_name;
52 
54  const int m_cost;
55 
59  std::vector<TowerType *> m_upgrade_options;
60 
61  // Initial values for new towers
62  const int m_damage;
63  const double m_attack_range;
64  const double m_attack_speed;
65 };
66 
67 
68 #endif //TOWER_DEFENCE_2_TOWER_H
Definition: object.h:19
Tower class.
Definition: tower.h:13
int m_damage
Amount of damage each hit deals.
Definition: object.h:87
double m_attack_speed
Attack speed, how fast does the object deal damage.
Definition: object.h:89
double m_attack_range
Attack range, how far can the object deal damage.
Definition: object.h:91
Description for creating new towers.
Definition: tower.h:28