Emergency 20 Dokumentation  4.2.0
MainEvent02.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 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
32  class MainEvent02 : public MainEvent
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Friends ]
38  //[-------------------------------------------------------]
39  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
40 
41 
42  //[-------------------------------------------------------]
43  //[ Public definitions ]
44  //[-------------------------------------------------------]
45  public:
46  static const uint32 FREEPLAY_EVENT_ID;
47 
48 
49  //[-------------------------------------------------------]
50  //[ Public methods ]
51  //[-------------------------------------------------------]
52  public:
57  MainEvent02();
58 
63  virtual ~MainEvent02();
64 
65 
66  //[-------------------------------------------------------]
67  //[ Public virtual em5::FreeplayEvent methods ]
68  //[-------------------------------------------------------]
69  public:
70  //[-------------------------------------------------------]
71  //[ Life cycle ]
72  //[-------------------------------------------------------]
73  virtual bool onStartup() override;
74  virtual void onShutdown() override;
75  virtual void onRun() override;
76  virtual bool onSuccess(EventResult& eventResult) override;
77  virtual bool onFailure(EventResult& eventResult) override;
78 
79  //[-------------------------------------------------------]
80  //[ Points evaluation ]
81  //[-------------------------------------------------------]
82  virtual uint32 calculatePointGain(EventResult& eventResult) override;
83 
84  //[-------------------------------------------------------]
85  //[ Callbacks from observers ]
86  //[-------------------------------------------------------]
87  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
88  virtual void hintCallback(Observer& hintObserver) override;
89 
90  //[-------------------------------------------------------]
91  //[ Miscellaneous ]
92  //[-------------------------------------------------------]
93  virtual const qsf::Entity* getFocusEntity() override;
94 
95  //[-------------------------------------------------------]
96  //[ Serialize ]
97  //[-------------------------------------------------------]
98  virtual void serialize(qsf::BinarySerializer& serializer) override;
99 
100 
101  //[-------------------------------------------------------]
102  //[ Protected virtual em5::MainEvent methods ]
103  //[-------------------------------------------------------]
104  protected:
105  virtual void onIntroStart(const qsf::MessageParameters& parameters) override;
106  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
107  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
108 
109  //[-------------------------------------------------------]
110  //[ Regular update ]
111  //[-------------------------------------------------------]
112  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
113  virtual void onUpdateMusic(const qsf::Time& timePassed) override;
114 
115  virtual uint32 getEventNumber() override;
116 
117 
118  //[-------------------------------------------------------]
119  //[ Private methods ]
120  //[-------------------------------------------------------]
121  private:
122  void gatherEventEntities();
123 
124  void startObjectives();
125  void startHintObservers();
126 
131  void startFallCutscene();
132 
137  void onFallCutsceneFinished(const qsf::MessageParameters& parameters);
138 
143  void onSquadRoadVehicleStartBurning();
144 
149  void createSaveHanggliderObjective(qsf::Entity& hangglider);
150 
155  void onHangGliderSaved();
156 
161  void onHangGliderPlacedFromDlk();
162 
167  void onBuildingExtinguished(const qsf::MessageParameters& parameters);
168 
173  void onHangGliderTransportedToHQ();
174 
175  void onGetsHeatEnergyPerson(const qsf::MessageParameters& parameters);
176 
181  void updateHangGliderFallingCountDown(const qsf::JobArguments& jobArguments);
182 
183  void startFire(const qsf::MessageParameters& parameters);
184 
185 
186  //[-------------------------------------------------------]
187  //[ Private data ]
188  //[-------------------------------------------------------]
189  private:
190  // Connected to CAMP
191  qsf::Time mHangGliderFallTime; // 300 sec.
192  float mHangGliderLifeEnergy; // Life energy after being rescued.
193 
194  int mMaxBurningBuildings; // 7
195 
196  qsf::Time mHint01WaitTime; // 20 sec.
197  qsf::Time mHint01WaitTime2; // 30 sec.
198 
199  qsf::Time mHint04WaitTime; // 90 sec.
200  qsf::Time mHint04WaitTime2; // 135 sec.
201 
202  int mMaxBurningVegetations; // 12
203  qsf::Time mHint05WaitTime2; // 45 sec.
204 
205  qsf::Time mHint07WaitTime; // 45 sec.
206  qsf::Time mHint07WaitTime2; // 90 sec.
207 
208  qsf::Time mHint02WaitTime; // 90 sec.
209 
210  float mHint10LifeEnergy; // 15%
211 
212  qsf::Time mHint11WaitTime; // 120 sec.
213  qsf::Time mHint13WaitTime; // 250 sec.
214  float mHint14LifeEnergy; // 15%
215 
216  qsf::Time mHint15WaitTime; // 60 sec.
217 
218  qsf::Time mHint18WaitTime; // 220 sec.
219  qsf::Time mHint20WaitTime; // 225 sec.
220 
221  qsf::Time mHint27WaitTime; // 20 sec.
222 
223  bool mHint01Triggered;
224  bool mHint03Triggered;
225  bool mHint04Triggered;
226  bool mHint05Triggered;
227  bool mHint16Triggered;
228 
229  // Internal
230  std::vector<qsf::Entity*> mWorkers;
231  qsf::Entity* mHangGlider;
232  qsf::Entity* mWindowPerson;
233 
234  std::vector<qsf::Entity*> mFires;
235  qsf::Entity* mDLK;
236 
237  qsf::MessageProxy mBuildingExtinguishedProxy;
238 
239  qsf::JobProxy mUpdateJobProxy;
240  qsf::MessageProxy mHangGliderSaveProxy;
241  qsf::Time mTimePassed;
242  qsf::Time mTimeToFall;
243 
244  qsf::MessageProxy mHeatEnergyPersonProxy;
245 
246  bool mHangGliderSaved;
247 
248  // Achievement
249  bool mHangGliderSavedPerfect;
250 
251  // Ending
252  bool mPlayingWinFadeOut;
253  bool mHasStartedFallCutscene;
254 
255 
256  //[-------------------------------------------------------]
257  //[ CAMP reflection system ]
258  //[-------------------------------------------------------]
259  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
260 
261 
262  };
263 
264 
265 //[-------------------------------------------------------]
266 //[ Namespace ]
267 //[-------------------------------------------------------]
268 } // em5
269 
270 
271 //[-------------------------------------------------------]
272 //[ CAMP reflection system ]
273 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
virtual bool onStartup() override
React to startup of the freeplay event.
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Job proxy class.
Definition: JobProxy.h:51
virtual void onShutdown() override
React to shutdown of the freeplay event.
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...
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
EMERGENCY 5 main event 02 "Munich hang glider accident".
Definition: MainEvent02.h:32
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
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 ...
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
MainEvent02()
Default constructor.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
virtual void onRun() override
React to state change from (initial) hidden state to running state.
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
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 void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
virtual ~MainEvent02()
Destructor.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent02" unique freeplay event ID
Definition: MainEvent02.h:46
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.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual void onIntroStart(const qsf::MessageParameters &parameters) override
React to the activation of the black screen, which is the start of the intro cutscene.
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