Emergency 20 Dokumentation  4.2.0
MainEvent307.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/audio/AudioProxy.h>
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
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  MainEvent307();
58 
63  virtual ~MainEvent307();
64 
65 
66  //[-------------------------------------------------------]
67  //[ Public virtual em5::FreeplayEvent methods ]
68  //[-------------------------------------------------------]
69  public:
70  //[-------------------------------------------------------]
71  //[ Lifecycle ]
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  //[ Timers ]
92  //[-------------------------------------------------------]
93  virtual void onTimerTriggered(uint32 timerId) override;
94 
95  //[-------------------------------------------------------]
96  //[ Miscellaneous ]
97  //[-------------------------------------------------------]
98  virtual const qsf::Entity* getFocusEntity() override;
99 
100  //[-------------------------------------------------------]
101  //[ Serialize ]
102  //[-------------------------------------------------------]
103  virtual void serialize(qsf::BinarySerializer& serializer) override;
104 
105 
106  //[-------------------------------------------------------]
107  //[ Protected virtual em5::MainEvent methods ]
108  //[-------------------------------------------------------]
109  protected:
110  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
111 
112  virtual uint32 getEventNumber() override;
113 
114 
115  //[-------------------------------------------------------]
116  //[ Private methods ]
117  //[-------------------------------------------------------]
118  private:
119  void setupScene();
120  void startObjectives();
121  void startTrainFall();
122 
123  void setDivingSpotActive(qsf::Entity& entity, bool active);
124 
125  void onCameraFlightStopped(const qsf::MessageParameters& parameters);
126  void onCutsceneEnd(const qsf::MessageParameters& parameters);
127  void onHangingPersonSavedPlacedFromDLK(const qsf::MessageParameters& parameters);
128  void onDivingSpotEntitySpawned(const qsf::MessageParameters& parameters);
129  void onCutVehicle(const qsf::MessageParameters& parameters);
130  void onEboxRepaired(const qsf::MessageParameters& parameters);
131 
132 
133  //[-------------------------------------------------------]
134  //[ Private data ]
135  //[-------------------------------------------------------]
136  private:
137  // Connected to CAMP
138  qsf::Time mTimeToRescueWater01;
139  qsf::Time mTimeToRescueWater02;
140  qsf::Time mTimeToRescueWater03;
141  qsf::Time mTimeToRescueWater04;
142  qsf::Time mTimeUntilTrainFalls;
143  qsf::Time mTimeUntilHint01;
144  qsf::Time mEboxUseTime;
145 
146  // Internal
147  struct PersonInWater
148  {
150  glm::vec3 mStartPosition;
151  glm::vec3 mEndPosition;
152  qsf::Time mTime;
153  qsf::Time mTotalTime;
154  bool mRescued = false;
155  bool mFadingOut = false;
156  };
157  struct DivingSpot
158  {
159  qsf::WeakPtr<qsf::Entity> mDivingSpotEntity;
160  bool mWasCleared = false;
161  };
162 
163  std::vector<PersonInWater> mPersonsInWater;
164  std::vector<DivingSpot> mDivingSpots;
165  qsf::WeakPtr<qsf::Entity> mHangingPerson;
166  qsf::WeakPtr<qsf::Entity> mTrainFall;
167  qsf::WeakPtr<qsf::Entity> mTrainFallPerson;
168  qsf::WeakPtr<qsf::Entity> mTrainFallDivingSpot;
169  qsf::WeakPtr<qsf::Entity> mTrainFallStartCamera;
170  qsf::WeakPtr<qsf::Entity> mTrainMoveSequence;
172  std::vector<qsf::WeakPtr<qsf::Entity>> mDeathZone;
173  qsf::WeakPtr<qsf::Entity> mDeathZoneSparks;
174  std::vector<qsf::WeakPtr<qsf::Entity>> mDeathZonePersonParticles;
175 
176  qsf::MessageProxy mCameraFlightStoppedMessageProxy;
177  qsf::MessageProxy mCutsceneEndMessageProxy;
178  qsf::MessageProxy mHangingPersonSaveProxy;
179  qsf::MessageProxy mDivingSpotEntitySpawnProxy;
180  qsf::MessageProxy mCutRoadVehicleProxy;
181  qsf::MessageProxy mRepairEboxMessageProxy;
182 
183  bool mTrainFallPersonRescued;
184  bool mDeathZoneActive;
185  qsf::AudioProxy mDeathZoneAudioProxy;
186 
187 
188  //[-------------------------------------------------------]
189  //[ CAMP reflection system ]
190  //[-------------------------------------------------------]
191  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
192 
193 
194  };
195 
196 
197 //[-------------------------------------------------------]
198 //[ Namespace ]
199 //[-------------------------------------------------------]
200 } // em5
201 
202 
203 //[-------------------------------------------------------]
204 //[ CAMP reflection system ]
205 //[-------------------------------------------------------]
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent307" unique freeplay event ID
Definition: MainEvent307.h:46
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
virtual bool onStartup() override
React to startup of the freeplay event.
unsigned int uint32
Definition: PlatformTypes.h:181
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 const qsf::Entity * getFocusEntity() override
Get an event entity that is currently crucial for this event This is the entity which gets the focus ...
The audio proxy resembles the playback of an audio asset.
Definition: AudioProxy.h:71
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
EMERGENCY 20 years edition mission base class.
Definition: Em20MainEventBase.h:30
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
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...
MainEvent307()
Default constructor.
virtual void onTimerTriggered(uint32 timerId) override
virtual void onShutdown() override
React to shutdown of the freeplay event.
EMERGENCY 20 years edition mission 07 "Train Accident".
Definition: MainEvent307.h:32
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
Binary serializer class.
Definition: BinarySerializer.h:35
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 bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
virtual ~MainEvent307()
Destructor.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32