Emergency 20 Dokumentation  4.2.0
MainEvent103.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 MainEvent103 : 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  MainEvent103();
59 
64  virtual ~MainEvent103();
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  virtual void hintCallback(Observer& hintObserver) override;
90 
91  //[-------------------------------------------------------]
92  //[ Miscellaneous ]
93  //[-------------------------------------------------------]
94  virtual const qsf::Entity* getFocusEntity() override;
95 
96  //[-------------------------------------------------------]
97  //[ Serialize ]
98  //[-------------------------------------------------------]
99  virtual void serialize(qsf::BinarySerializer& serializer) override;
100 
101 
102  //[-------------------------------------------------------]
103  //[ Protected virtual em5::MainEvent methods ]
104  //[-------------------------------------------------------]
105  protected:
106  virtual void onIntroStart(const qsf::MessageParameters& parameters) override;
107  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
108  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
109  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
110  virtual void onUpdateMusic(const qsf::Time& timePassed) override;
111  virtual uint32 getEventNumber() override;
112  virtual std::string getCamStartEventTag() override;
113 
114 
115  //[-------------------------------------------------------]
116  //[ Private methods ]
117  //[-------------------------------------------------------]
118  private:
119  void spawnVehicleWave();
120  void spawnVehicle(int spawnPointId);
121  void enableSpawningFromeBrawlerWave4();
122 
123  void gatherEventEntities();
124  void removeGangsterFromList(uint64 targetEntity);
125 
126  void startObjectives();
127  void startHintObservers();
128 
129  void spawnBrawl(int id);
130  void onStartArrestGangsterMessage(const qsf::MessageParameters& parameters);
131  void onStartBurningBuildingMessage(const qsf::MessageParameters& parameters);
132 
133  void triggerHint01();
134 
135  void onStopBurningBuildingMessage(const qsf::MessageParameters& parameters);
136  void onStartBurningObject(const qsf::MessageParameters& parameters);
137  void onStopBurningObject(const qsf::MessageParameters& parameters);
138  bool isBarrierSafe(const glm::vec3& center, float radius);
139  void checkBarrierSafeness(qsf::Entity& barrier1, bool& safeFlag);
140  void onObjectiveCompleted(const qsf::MessageParameters& messageParameters);
141 
142 
143  //[-------------------------------------------------------]
144  //[ Private definitions ]
145  //[-------------------------------------------------------]
146  private:
147  enum NPCVehicleState
148  {
149  DRIVING_TO_TARGET,
150  DRIVING_TO_DESPAWNPOINT
151  };
152 
153  struct NPCVehicle
154  {
155  int mSpawnPointId;
156  uint64 mVehicleId;
157  uint64 mTargetId;
158  float lastDistance;
159  qsf::Time mCount;
160  NPCVehicleState mState;
161  };
162 
163 
164  //[-------------------------------------------------------]
165  //[ Private data ]
166  //[-------------------------------------------------------]
167  private:
168  std::vector<uint64> mGangsterIds;
169  std::vector<uint64> mGangsterIdsBrawl1;
170  std::vector<uint64> mGangsterIdsBrawl2;
171  std::vector<uint64> mGangsterIdsBrawl3;
172  std::vector<uint64> mGangsterIdsBrawl4;
173 
174  int mBarrierCount;
175  float mNPCWaitingtime;
176  int mIndexNPCVehicleSpawnTimeBarrier1;
177  int mIndexNPCVehicleSpawnTimeBarrier2;
178 
179  qsf::Time mEventTime;
180  std::vector<NPCVehicle> mNPCVehicles;
181 
182  bool mTriggeredBrawl1;
183  bool mTriggeredBrawl2;
184  bool mTriggeredBrawl3;
185  bool mTriggeredBrawl4;
186  bool mCanTriggerBrawl4;
187 
188  int mFreeGangsterCount;
189  qsf::MessageProxy mGangsterMessageProxy;
190  qsf::MessageProxy mFireBuildingStartProxy;
191  qsf::MessageProxy mFireBuildingStopProxy;
192  qsf::MessageProxy mFireObjectStartProxy;
193  qsf::MessageProxy mFireObjectStopProxy;
194  qsf::MessageProxy mObjectiveCompletedProxy;
195  qsf::Time mActualHint01CoolDown;
196  int mBurningObjects;
197  int mBurningBuildings;
198  bool mTriggerdHint03Brawl1;
199  bool mTriggerdHint03Brawl2;
200  bool mTriggerdHint03Brawl3;
201  bool mTriggerdHint03Brawl4;
202 
203  bool mTriggerdHint06Brawl1;
204  bool mTriggerdHint06Brawl2;
205  bool mTriggerdHint06Brawl3;
206  bool mTriggerdHint06Brawl4;
207  bool mTriggeredHint02;
208  bool mTriggerdHint07;
209  bool mTriggerdUnitHint01;
210  bool mTriggerdSupervisorMessageBurningBuilding;
211 
212  std::vector<qsf::WeakPtr<qsf::Entity>> mBarriers;
213  std::vector<bool> mIsBarrierSafe;
214 
215  qsf::Time mHint03CoolDown;
216 
217  // Connected to CAMP
218  int mAiPoliceCars;
219 
220  std::vector<qsf::Time> mNPCVehcileSpawnTimeBarrier1;
221  std::vector<qsf::Time> mNPCVehcileSpawnTimeBarrier2;
222 
223  qsf::Time mBrawl1StartTime;
224  qsf::Time mBrawl2StartTime;
225  qsf::Time mBrawl3StartTime;
226  qsf::Time mBrawl4StartTime;
227 
228  qsf::Time mHint01CoolDownTime;
229  int mHint01MaxBurningObjects;
230 
231  qsf::Time mHint03WaitTime;
232  qsf::Time mHint06WaitTime;
233 
234  int mHint07OfficeCount;
235  qsf::Time mHint07WaitTime;
236  qsf::Time mHint09WaitTime;
237  qsf::Time mHint10WaitTime;
238  int mHint10GangsterCount;
239 
240  float mBrawlerUnarmedAggroRange;
241  float mBrawlerUnarmedDeAggroRange;
242  qsf::Time mBrawlerUnarmedCheerTime;
243  qsf::Time mArsonistCheerTime;
244 
245 
246  //[-------------------------------------------------------]
247  //[ CAMP reflection system ]
248  //[-------------------------------------------------------]
249  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
250 
251 
252  };
253 
254 
255 //[-------------------------------------------------------]
256 //[ Namespace ]
257 //[-------------------------------------------------------]
258 } // em5
259 
260 
261 //[-------------------------------------------------------]
262 //[ CAMP reflection system ]
263 //[-------------------------------------------------------]
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
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...
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
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 uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
virtual void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
MainEvent103()
Default constructor.
virtual void onRun() override
React to state change from (initial) hidden state to running state.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual std::string getCamStartEventTag() override
Return event tag of a start camera for the event; only necessary for main events without prologue cut...
virtual bool onStartup() override
React to startup of the freeplay event.
uint64_t uint64
Definition: PlatformTypes.h:184
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 hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
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 bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent103" unique freeplay event ID
Definition: MainEvent103.h:47
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 ...
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
virtual ~MainEvent103()
Destructor.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual void onShutdown() override
React to shutdown of the freeplay event.
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 main event 103 "Hamburg".
Definition: MainEvent103.h:33
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32