Emergency 20 Dokumentation  4.2.0
BuildingNearlyCollapseEvent.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 
15 #include <qsf/base/WeakPtr.h>
17 #include <qsf/time/Time.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Namespace ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25 
26 
27  //[-------------------------------------------------------]
28  //[ Classes ]
29  //[-------------------------------------------------------]
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Public definitions ]
41  //[-------------------------------------------------------]
42  public:
43  static const uint32 FREEPLAY_EVENT_ID;
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public methods ]
48  //[-------------------------------------------------------]
49  public:
55 
60  virtual ~BuildingNearlyCollapseEvent();
61 
71  void init(qsf::Entity& targetBuilding, bool isTutorial);
72 
73  void setAmbientLayerName(const std::string& layerName);
74  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(FailEvacuateBuildingTimer, qsf::Time, mFailEvacuateBuildingTimer);
75  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(FailRepairBuildingTimer, qsf::Time, mFailRepairBuildingTimer);
76 
77 
78  //[-------------------------------------------------------]
79  //[ Public virtual em5::FreeplayEvent methods ]
80  //[-------------------------------------------------------]
81  public:
82  virtual bool onStartup() override;
83  virtual void onShutdown() override;
84  virtual void onRun() override;
85  virtual bool onFailure(EventResult& eventResult) override;
86  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
87  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
88  virtual void hintCallback(Observer& hintObserver) override;
89  virtual bool checkEventConfiguration() override;
90  virtual const qsf::Entity* getFocusEntity() override;
91  virtual void serialize(qsf::BinarySerializer& serializer) override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Private methods ]
96  //[-------------------------------------------------------]
97  private:
98  void onPersonRescueFromBuilding(const qsf::MessageParameters& parameters);
99  void onBreakBuildingDoor(const qsf::MessageParameters& parameters);
100  void onBuildingRepaired(const qsf::MessageParameters& parameters);
101 
102 
103  //[-------------------------------------------------------]
104  //[ Private data ]
105  //[-------------------------------------------------------]
106  private:
107  qsf::WeakPtr<qsf::Entity> mTargetBuilding;
108  bool mIsTutorial; // "true" if special tutorial hints are displayed
109 
110  qsf::MessageProxy mRescuedFromBuildingMessageProxy;
111  qsf::MessageProxy mRepairBuildingMessageProxy;
112 
113  std::string mAmbientLayerName;
114  bool mIsBuildingEvacuated;
115  bool mIsBuildingReparied;
116 
117  // Event fail
118  qsf::Time mFailEvacuateBuildingTimer;
119  qsf::Time mFailRepairBuildingTimer;
120 
121  // Tutorial
122  qsf::Time mTutorialHint1Timer;
123  bool mTutorialHint1Played;
124  bool mTutorialHint2Played;
125  qsf::MessageProxy mBreakBuildingDoorMessageProxy;
126  bool mTutorialHint3Played;
127 
128 
129  //[-------------------------------------------------------]
130  //[ CAMP reflection system ]
131  //[-------------------------------------------------------]
132  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
133 
134 
135  };
136 
137 
138 //[-------------------------------------------------------]
139 //[ Namespace ]
140 //[-------------------------------------------------------]
141 } // em5
142 
143 
144 //[-------------------------------------------------------]
145 //[ CAMP reflection system ]
146 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
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
static const uint32 FREEPLAY_EVENT_ID
"em5::BuildingNearlyCollapseEvent" unique freeplay event ID
Definition: BuildingNearlyCollapseEvent.h:43
#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
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 freeplay event "building nearly collapse" This is also a tutorial event // TODO(co) "This...
Definition: BuildingNearlyCollapseEvent.h:35
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32