Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
defendareatask.h
1 #pragma once
2 
3 #include "ai/aigrouptask.h"
4 
5 #include <list>
6 
7 #include "glm/glm.hpp"
8 
9 #include "ai/basictasks/flytotask.h"
10 #include "ai/basictasks/fighttask.h"
11 
12 class CollisionFilter;
13 class Squad;
14 class Sphere;
15 
16 class DefendAreaTask : public AiGroupTask {
17 public:
18  DefendAreaTask(Squad& squad, std::list<glm::vec3> points, float defendRange);
19  ~DefendAreaTask();
20 
21  void addPoint(const glm::vec3& point);
22 
23  const std::list<glm::vec3>& points();
24  float range();
25 
26  virtual void update(float deltaSec) override;
27 
28 protected:
29  virtual void onNewLeader(Ship* leader) override;
30  virtual void onMemberJoin(Ship* member) override;
31  void updatePatrol();
32  void updateFight();
33 
34  bool isEnemyInRange();
35 
36  std::unique_ptr<CollisionFilter> m_collisionFilter;
37  std::shared_ptr<FlyToTask> m_leaderFlyTask;
38  std::shared_ptr<FightTask> m_fightTask;
39  std::list<glm::vec3> m_points;
40  std::list<glm::vec3>::iterator m_currentPoint;
41  std::vector<Handle<WorldObject>> m_enemies;
42 
43  float m_defendRange;
44 };
45 
Definition: collisionfilter.h:9
Definition: defendareatask.h:16
Definition: aigrouptask.h:16
Definition: sphere.h:11
Definition: squad.h:16
Definition: ship.h:23