Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
worldobjectcomponents.h
1 #pragma once
2 
3 #include <list>
4 #include <memory>
5 
6 #include "equipment/enginepower.h"
7 #include "equipment/enginestate.h"
8 
9 
10 class EngineSlot;
11 class Hardpoint;
12 class HardpointVoxel;
13 class WorldObject;
14 
23 public:
24  WorldObjectComponents(WorldObject* worldObject);
25 
26  WorldObject* worldObject();
27  const WorldObject* worldObject() const;
28 
29  void addEngineSlot(std::shared_ptr<EngineSlot> engineSlot);
30  void removeEngineSlot(const EngineSlot* engineSlot);
31 
32  /*
33  Access EngineSlots either by index in the model or all of them
34  at a time
35  */
36  std::shared_ptr<EngineSlot> engineSlot(int index);
37  std::list<std::shared_ptr<EngineSlot>>& engineSlots();
38 
39  /*
40  Poll all installed engines for accumulated power
41  */
42  EnginePower enginePower() const;
43 
44  /*
45  Acceleration of all engines accumulated;
46  */
47  Acceleration currentAcceleration() const;
48 
49  /*
50  Set relative state on all installed engines,
51  the value returned by engineState() is the last set and doesn't react on
52  possible indivdual changes of engines;
53  */
54  const EngineState& engineState() const;
55  void setEngineState(const EngineState& engineState);
56 
57 
58  void addHardpoint(std::shared_ptr<Hardpoint> hardpoint);
59  void removeHardpoint(const Hardpoint* hardpoint);
60 
61  /*
62  Access Hardpoints either by index in the model or all of them
63  at a time
64  */
65  std::shared_ptr<Hardpoint> hardpoint(int index);
66  std::list<std::shared_ptr<Hardpoint>>& hardpoints();
67 
68  /*
69  Fire all installed weapons either at a point or a WorldObject
70  What of both will actually trigger an action depends on the weapons
71  aimType
72  */
73  void fireAtPoint(const glm::vec3& point);
74  void fireAtObject(WorldObject* worldObject);
75 
76  /*
77  Update all components
78  */
79  void update(float deltaSec);
80 
81 
82 
83 protected:
84  WorldObject* m_worldObject;
85 
86  std::list<std::shared_ptr<EngineSlot>> m_engineSlots;
87  std::list<std::shared_ptr<Hardpoint>> m_hardpoints;
88 
89  EngineState m_engineState;
90 };
91 
Definition: enginepower.h:22
Definition: worldobject.h:43
Definition: hardpoint.h:18
Definition: engineslot.h:17
Definition: worldobjectcomponents.h:22
Definition: abstractmove.h:5
Definition: hardpointvoxel.h:10