Emergency 20 Dokumentation  4.2.0
InjurePersonAreaComponent.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
17 #include <qsf/job/JobProxy.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace qsf
25 {
26  class ParameterGroup;
27  class JobArguments;
28  class TransformComponent;
29 }
30 
31 
32 //[-------------------------------------------------------]
33 //[ Namespace ]
34 //[-------------------------------------------------------]
35 namespace em5
36 {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Classes ]
41  //[-------------------------------------------------------]
47  {
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public definitions ]
52  //[-------------------------------------------------------]
53  public:
54  static const uint32 COMPONENT_ID;
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public methods ]
59  //[-------------------------------------------------------]
60  public:
68  explicit InjurePersonAreaComponent(qsf::Prototype* prototype);
69 
74  inline virtual ~InjurePersonAreaComponent();
75 
80  inline bool getSimulationState() const;
81 
86  inline float getAffectedAreaRadius() const;
87 
92  void setAffectedAreaRadius(float affectedAreaRadius);
93 
98  inline const std::string& getInjuriesToUse() const;
99 
104  void setInjuriesToUse(const std::string& injuriesToUse);
105 
110  bool isInsideAffectedAreaRadius(const glm::vec3& position);
111 
112 
113  //[-------------------------------------------------------]
114  //[ Public virtual qsf::Component methods ]
115  //[-------------------------------------------------------]
116  public:
117  virtual void serialize(qsf::BinarySerializer& serializer) override;
118 
119 
120  //[-------------------------------------------------------]
121  //[ Protected virtual qsf::Component methods ]
122  //[-------------------------------------------------------]
123  protected:
124  virtual bool onStartup() override;
125  virtual void onShutdown() override;
126  virtual void onSetSimulating(bool simulating) override;
127  virtual void onSetActive(bool active) override;
128  virtual void onSetDebug(bool debug) override;
129  inline virtual bool implementsOnComponentPropertyChange() const override { return true; }
130  virtual void onComponentPropertyChange(const Component& component, uint32 propertyId) override;
131 
132 
133  //[-------------------------------------------------------]
134  //[ Private methods ]
135  //[-------------------------------------------------------]
136  private:
137  void internalSetActive(bool active);
138  void addRequest(const qsf::TransformComponent& transformComponent);
139  void onPropertyChange();
140 
141  void manageContaminationSpreading(const qsf::JobArguments& jobArguments);
142 
143  void onDebugGroupPropertyChanged(const qsf::ParameterGroup& parameterGroup, uint32 propertyId);
144 
145 
146  //[-------------------------------------------------------]
147  //[ Private data ]
148  //[-------------------------------------------------------]
149  private:
150  // Connected to camp
151  float mAffectedAreaRadius;
152  std::string mInjuriesToUse;
153 
154  // Internal
155  std::vector<uint32> mInjuriesToUseList;
156 
157  qsf::JobProxy mSimulationJobProxy;
158  qsf::MessageProxy mMessageProxy;
159  qsf::DebugDrawProxy mDebugDrawProxy;
160 
161 
162  //[-------------------------------------------------------]
163  //[ CAMP reflection system ]
164  //[-------------------------------------------------------]
165  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
166 
167 
168  };
169 
170 
171 //[-------------------------------------------------------]
172 //[ Namespace ]
173 //[-------------------------------------------------------]
174 } // em5
175 
176 
177 //[-------------------------------------------------------]
178 //[ Implementation ]
179 //[-------------------------------------------------------]
181 
182 
183 //[-------------------------------------------------------]
184 //[ CAMP reflection system ]
185 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Abstract component class.
Definition: Component.h:105
Abstract parameter group class.
Definition: ParameterGroup.h:31
unsigned int uint32
Definition: PlatformTypes.h:181
Transform component class.
Definition: TransformComponent.h:33
virtual bool implementsOnComponentPropertyChange() const override
Signal whether this component needs the "onComponentPropertyChange" callback at all.
Definition: InjurePersonAreaComponent.h:129
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
static const uint32 COMPONENT_ID
"em5::InjurePersonAreaComponent" unique component ID
Definition: InjurePersonAreaComponent.h:54
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
Debug draw proxy class.
Definition: DebugDrawProxy.h:46
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Prototype class.
Definition: Prototype.h:100
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 injure person area component class.
Definition: InjurePersonAreaComponent.h:46