Emergency 20 Dokumentation  4.2.0
InjuryAtStartupComponent.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 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
16 #include <qsf/job/JobProxy.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Namespace ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25 
26 
27  //[-------------------------------------------------------]
28  //[ Classes ]
29  //[-------------------------------------------------------]
38  {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Public definitions ]
43  //[-------------------------------------------------------]
44  public:
45  static const uint32 COMPONENT_ID;
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public static methods ]
50  //[-------------------------------------------------------]
51  public:
52  static uint32 getInjuryIdForEntity(qsf::Entity& entity, uint32 fallbackId = qsf::getUninitialized<uint32>(0));
53 
54 
55  //[-------------------------------------------------------]
56  //[ Public methods ]
57  //[-------------------------------------------------------]
58  public:
66  explicit InjuryAtStartupComponent(qsf::Prototype* prototype);
67 
72  virtual ~InjuryAtStartupComponent();
73 
74  uint32 getInjuryId() const;
75  const std::string& getInjuryName() const;
76  void setInjuryName(const std::string& injuryName);
77 
78  bool getAutoApply() const;
79  void setAutoApply(bool autoApply);
80 
81 
82  //[-------------------------------------------------------]
83  //[ Public virtual qsf::Component methods ]
84  //[-------------------------------------------------------]
85  public:
86  virtual void serialize(qsf::BinarySerializer& serializer) override;
87 
88 
89  //[-------------------------------------------------------]
90  //[ Protected virtual qsf::Component methods ]
91  //[-------------------------------------------------------]
92  protected:
93  virtual void onSetSimulating(bool simulating) override;
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private methods ]
98  //[-------------------------------------------------------]
99  private:
100  void updateSimulation(const qsf::JobArguments& jobArguments);
101 
102 
103  //[-------------------------------------------------------]
104  //[ Private data ]
105  //[-------------------------------------------------------]
106  private:
107  // Connected to CAMP
108  qsf::NamedIdentifier mInjuryName;
109  bool mAutoApply;
110 
111  // Internal
112  qsf::JobProxy mSimulationJobProxy;
113 
114 
115  //[-------------------------------------------------------]
116  //[ CAMP reflection system ]
117  //[-------------------------------------------------------]
118  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
119 
120 
121  };
122 
123 
124 //[-------------------------------------------------------]
125 //[ Namespace ]
126 //[-------------------------------------------------------]
127 } // em5
128 
129 
130 //[-------------------------------------------------------]
131 //[ CAMP reflection system ]
132 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 injury at startup component class.
Definition: InjuryAtStartupComponent.h:37
Job proxy class.
Definition: JobProxy.h:51
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
static const uint32 COMPONENT_ID
"em5::InjuryAtStartupComponent" unique component ID
Definition: InjuryAtStartupComponent.h:45
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
#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
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Prototype class.
Definition: Prototype.h:100
Binary serializer class.
Definition: BinarySerializer.h:35