Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
squad.h
1 #pragma once
2 
3 #include <vector>
4 #include <memory>
5 
6 #include "glm/glm.hpp"
7 #include "scripting/scriptable.h"
8 
9 class Ship;
10 class AiGroupTask;
11 
16 class Squad : public Scriptable {
17 public:
18  Squad(Ship* leader = nullptr);
19  ~Squad();
20 
21  Ship* leader();
22  void setLeader(Ship* leader);
23 
24  std::shared_ptr<AiGroupTask> task();
25  void setTask(std::shared_ptr<AiGroupTask> task);
26 
27  const std::vector<Ship*>& members();
28 
29 
30 protected:
31  friend class SquadLogic;
32 
33  // Interface for SquadLogic
34  void onMemberJoin(Ship* member);
35  void onMemberLeave(Ship* member);
36  glm::vec3 formationPositionFor(Ship* member);
37  glm::vec3 formationUpFor(Ship* member);
38 
39 
40  void chooseNewLeader();
41  glm::vec3 calculateFormationPosition(Ship* member, int position);
42 
43  Ship* m_leader;
44  std::vector<Ship*> m_members;
45  std::shared_ptr<AiGroupTask> m_task;
46 };
47 
Definition: aigrouptask.h:16
Definition: squadlogic.h:14
Definition: squad.h:16
Definition: scriptable.h:4
Definition: ship.h:23