Emergency 20 Dokumentation  4.2.0
BuildingCollapseEvent.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/time/Time.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Namespace ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25 
26 
27  //[-------------------------------------------------------]
28  //[ Classes ]
29  //[-------------------------------------------------------]
35  {
36 
37 
38  //[-------------------------------------------------------]
39  //[ Public definitions ]
40  //[-------------------------------------------------------]
41  public:
42  static const uint32 FREEPLAY_EVENT_ID;
43 
44 
45  //[-------------------------------------------------------]
46  //[ Public methods ]
47  //[-------------------------------------------------------]
48  public:
54 
59  virtual ~BuildingCollapseEvent();
60 
72  void init(uint64 buildingId, const std::string& eventTagDebris, const std::string& eventTagExplosion, bool spawnPersonsUnderDebris);
73 
74  //[-------------------------------------------------------]
75  //[ Public function to set/get with CAMP ]
76  //[-------------------------------------------------------]
81  float getDebrisSpawnTime() const;
82  void setDebrisSpawnTime(float seconds);
83 
88  float getDamageBuildingTime() const;
89  void setDamageBuildingTime(float seconds);
90 
95  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(ExplosionRadius, float, mExplosionRadius)
96 
97 
101  float getHint01WaitTime() const;
102  void setHint01WaitTime(float seconds);
103 
108  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(Hint02LifeEnergy, float, mHint2LifeEnergy)
109 
110 
111  //[-------------------------------------------------------]
112  //[ Public virtual em5::FreeplayEvent methods ]
113  //[-------------------------------------------------------]
114  public:
115  virtual bool onStartup() override;
116  virtual void onShutdown() override;
117  virtual void onRun() override;
118  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
119  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
120  virtual void hintCallback(Observer& hintObserver) override;
121  virtual bool checkEventConfiguration() override;
122  virtual const qsf::Entity* getFocusEntity() override;
123  virtual void serialize(qsf::BinarySerializer& serializer) override;
124 
125 
126  //[-------------------------------------------------------]
127  //[ Private methods ]
128  //[-------------------------------------------------------]
129  private:
130  void onStartRunning(const qsf::MessageParameters& parameters);
131  void onDamageBuilding(const qsf::MessageParameters& parameters);
132  void onUnbury(const qsf::MessageParameters& parameters);
133 
134  bool collectEventTagEntities(qsf::Entity& buildingEntity);
135  bool explodeBuilding(qsf::Entity& buildingEntity);
136  void startFires(const qsf::Entity& buildingEntity);
137  void spawnDebrisAndInjured(qsf::Entity& buildingEntity);
138  void spawnRubble(qsf::Entity& buildingEntity);
139  qsf::Entity* getPersonPlaceholderLinked(qsf::Entity& entity) const;
140  std::string getAdultCivilianPrefabName() const;
141  void usePlaceholderTransform(qsf::Entity& entity, const qsf::Entity& placeholder) const;
142 
143 
144  //[-------------------------------------------------------]
145  //[ Private data ]
146  //[-------------------------------------------------------]
147  private:
148  qsf::MessageProxy mTimerMessageProxy;
149  uint32 mDamageTimerId;
150  uint32 mDebrisTimerId;
151  qsf::MessageProxy mCraneLiftMessageProxy;
152  uint64 mTargetBuildingId;
153  uint64 mExplosionId;
154  float mExplosionRadius;
155  qsf::Time mDamageBuildingTime;
156  qsf::Time mDebrisSpawnTime;
157  qsf::Time mHint01WaitTime;
158  float mHint2LifeEnergy;
159  glm::vec3 mExplosionCenter;
160  uint32 mMinDebris;
161  uint32 mMaxDebris;
162  std::vector<uint64> mDebris;
163  std::vector<uint64> mVictims;
164  std::string mEventTagDebris;
165  std::string mEventTagExplosion;
166  bool mSpawnPersonsUnderDebris;
167  qsf::Entity* mExplosion;
168  std::vector<qsf::Entity*> mDebrisPlaceholders;
169  uint32 mPlayerActivityObserverId;
170 
171 
172  //[-------------------------------------------------------]
173  //[ CAMP reflection system ]
174  //[-------------------------------------------------------]
175  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
176 
177 
178  };
179 
180 
181 //[-------------------------------------------------------]
182 //[ Namespace ]
183 //[-------------------------------------------------------]
184 } // em5
185 
186 
187 //[-------------------------------------------------------]
188 //[ CAMP reflection system ]
189 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: AreaConfiguration.h:58
Reason
Definition: EventSpreadReason.h:20
static const uint32 FREEPLAY_EVENT_ID
"em5::BuildingCollapseEvent" unique freeplay event ID
Definition: BuildingCollapseEvent.h:42
uint64_t uint64
Definition: PlatformTypes.h:184
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
#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
EMERGENCY 5 freeplay event "9.4 building collapse".
Definition: BuildingCollapseEvent.h:34
#define QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(name, type, variable)
Definition: PropertyHelper.h:16
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66