Emergency 20 Dokumentation  4.2.0
MainEvent05.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/job/JobProxy.h>
16 #include <qsf/base/WeakPtr.h>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
33  class MainEvent05 : public MainEvent
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Friends ]
39  //[-------------------------------------------------------]
40  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public definitions ]
45  //[-------------------------------------------------------]
46  public:
47  static const uint32 FREEPLAY_EVENT_ID;
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public methods ]
52  //[-------------------------------------------------------]
53  public:
58  MainEvent05();
59 
64  virtual ~MainEvent05();
65 
66 
67  //[-------------------------------------------------------]
68  //[ Public virtual em5::FreeplayEvent methods ]
69  //[-------------------------------------------------------]
70  public:
71  //[-------------------------------------------------------]
72  //[ Life cycle ]
73  //[-------------------------------------------------------]
74  virtual bool onStartup() override;
75  virtual void onShutdown() override;
76  virtual void onRun() override;
77  virtual bool onSuccess(EventResult& eventResult) override;
78  virtual bool onFailure(EventResult& eventResult) override;
79 
80  //[-------------------------------------------------------]
81  //[ Points evaluation ]
82  //[-------------------------------------------------------]
83  virtual uint32 calculatePointGain(EventResult& eventResult) override;
84 
85  //[-------------------------------------------------------]
86  //[ Callbacks from observers ]
87  //[-------------------------------------------------------]
88  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
89 
90  virtual void hintCallback(Observer& hintObserver) override;
91 
92  //[-------------------------------------------------------]
93  //[ Miscellaneous ]
94  //[-------------------------------------------------------]
95  virtual const qsf::Entity* getFocusEntity() override;
96 
97  //[-------------------------------------------------------]
98  //[ Serialize ]
99  //[-------------------------------------------------------]
100  virtual void serialize(qsf::BinarySerializer& serializer) override;
101 
102 
103  //[-------------------------------------------------------]
104  //[ Protected virtual em5::MainEvent methods ]
105  //[-------------------------------------------------------]
106  protected:
107  virtual void onIntroStart(const qsf::MessageParameters& parameters) override;
108  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
109  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
110  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
111  virtual void onUpdateMusic(const qsf::Time& timePassed) override;
112  virtual uint32 getEventNumber() override;
113 
114 
115  //[-------------------------------------------------------]
116  //[ Private methods ]
117  //[-------------------------------------------------------]
118  private:
119  void gatherEventEntities();
120 
121  void startObjectives();
122  void startHintObservers();
123 
128  void checkExplosionCondition();
129 
134  void startExplosion();
135 
140  void onExplosionCutsceneEnded(const qsf::MessageParameters& parameters);
141 
146  void onCraneSetDownCar();
147 
152  void onCarCutOpen();
153 
158  void onIntroDestroyMessage(const qsf::MessageParameters& parameters);
159 
164  void onStartFireMessage(const qsf::MessageParameters& parameters);
165 
170  void onExplosionDestroyMessage(const qsf::MessageParameters& parameters);
171 
176  void createExtinguishingFireObjective(qsf::Entity& trucker);
177 
178  void setSkiLiftActive(bool active);
179 
180  void triggerHint13();
181 
182  void onRescueDogFindPerson(const qsf::MessageParameters& parameters);
183 
184  void checkToStartHint07Timer();
185 
186 
187  //[-------------------------------------------------------]
188  //[ Private data ]
189  //[-------------------------------------------------------]
190  private:
191  // Connected to CAMP
192  int mFailConditionMaxFires;
193 
194  uint32 mInjuredLeftTillExplosion; // 3
195 
196  float mHint01LifeEnergy; // 10%
197  float mHint02LifeEnergy; // 20%
198  float mHint03LifeEnergy; // 15%
199 
200  qsf::Time mHint04WaitTime; // 60 sec.
201 
202  qsf::Time mHint05WaitTime; // 20 sec.
203  qsf::Time mHint05WaitTime2; // 40 sec.
204  qsf::Time mHint06WaitTime; // 30 sec.
205  qsf::Time mHint07WaitTime; // 20 sec.
206  qsf::Time mHint08WaitTime; // 10 sec.
207  qsf::Time mHint09WaitTime; // 40 sec.
208  qsf::Time mHint10WaitTime; // 40 sec.
209 
210  float mHint11LifeEnergy; // 25%
211  float mHint12LifeEnergy; // 15%
212 
213  bool mOrderedTechHeli;
214  bool mRescueDogFindPerson;
215 
216  uint32 mHint13FireCount; // 10
217  bool mHint13Triggered;
218  bool mHint13TimerStarted;
219  bool mHint13PreCondition;
220  qsf::Time mHint13WaitTime;
221 
222  uint32 mHint14FireCount; // 15
223  qsf::Time mHint15WaitTime; // 30 sec.
224  qsf::Time mHint16WaitTime; // 75 sec.
225  qsf::Time mHint17WaitTime; // 90 sec.
226 
227  bool mHint01Triggered;
228  bool mHint02Triggered;
229  bool mHint03Triggered;
230  bool mHint12Triggered;
231 
232  // Internal
233  std::vector<qsf::Entity*> mVictim;
234  std::vector<qsf::Entity*> mBuriedVictims;
235  std::vector<qsf::Entity*> mGaper;
237  qsf::Entity* mCarVictim;
238 
239  std::vector<qsf::Entity*> mFires;
240  qsf::MessageProxy mUpdateJobProxyFire;
241  qsf::MessageProxy mUpdateJobProxyDestroy;
242  qsf::MessageProxy mCraneLiftedCarMessageProxy;
243  qsf::MessageProxy mRescueDogFindPersonProxy;
244  qsf::Entity* mHotel;
245  qsf::Entity* mSkiLift01;
246  qsf::Entity* mSkiLift02;
247  qsf::Entity* mExplosionDestroyedHouse;
248 
249  uint32 mPreviousPersonsLeftForExplosion;
250  bool mWasGasExplosionTriggered;
251  qsf::JobProxy mGasExplosionConditionCheckJob;
252 
253  // Ending
254  bool mPlayingWinFadeOut;
255 
256  // Achievement
257  qsf::Time mAchievementTimeLimit;
258 
259  // Music
260  uint32 mNumberOfBurningObjectsOnHint15;
261 
262 
263  //[-------------------------------------------------------]
264  //[ CAMP reflection system ]
265  //[-------------------------------------------------------]
266  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
267 
268 
269  };
270 
271 
272 //[-------------------------------------------------------]
273 //[ Namespace ]
274 //[-------------------------------------------------------]
275 } // em5
276 
277 
278 //[-------------------------------------------------------]
279 //[ CAMP reflection system ]
280 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
virtual const qsf::Entity * getFocusEntity() override
Get an event entity that is currently crucial for this event This is the entity which gets the focus ...
Job proxy class.
Definition: JobProxy.h:51
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
unsigned int uint32
Definition: PlatformTypes.h:181
virtual bool addEntityToEvent(qsf::Entity &targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override
React to adding to an entity to this event, i.e. setting the event ID for the entity.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
virtual void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
EMERGENCY 5 main event 05 "Munich avalanche".
Definition: MainEvent05.h:33
virtual void onUpdateMusic(const qsf::Time &timePassed) override
Gets called when the main event gets an update call We use here a separate update method...
virtual void onIntroStart(const qsf::MessageParameters &parameters) override
React to the activation of the black screen, which is the start of the intro cutscene.
virtual void onShutdown() override
React to shutdown of the freeplay event.
#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
MainEvent05()
Default constructor.
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent05" unique freeplay event ID
Definition: MainEvent05.h:47
virtual void onUpdateMainEvent(const qsf::Time &timePassed) override
Gets called when the main event gets an update call We use here a separate update method...
virtual ~MainEvent05()
Destructor.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual void onRun() override
React to state change from (initial) hidden state to running state.
virtual bool onStartup() override
React to startup of the freeplay event.
Binary serializer class.
Definition: BinarySerializer.h:35
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32