Emergency 20 Dokumentation  4.2.0
MainEvent302.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 
16 //[-------------------------------------------------------]
17 //[ Namespace ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21 
22 
23  //[-------------------------------------------------------]
24  //[ Classes ]
25  //[-------------------------------------------------------]
31  {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Friends ]
36  //[-------------------------------------------------------]
37  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
38 
39 
40  //[-------------------------------------------------------]
41  //[ Public definitions ]
42  //[-------------------------------------------------------]
43  public:
44  static const uint32 FREEPLAY_EVENT_ID;
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public methods ]
49  //[-------------------------------------------------------]
50  public:
55  MainEvent302();
56 
61  virtual ~MainEvent302();
62 
63 
64  //[-------------------------------------------------------]
65  //[ Public virtual em5::FreeplayEvent methods ]
66  //[-------------------------------------------------------]
67  public:
68  //[-------------------------------------------------------]
69  //[ Lifecycle ]
70  //[-------------------------------------------------------]
71  virtual bool onStartup() override;
72  virtual void onShutdown() override;
73  virtual void onRun() override;
74  virtual bool onSuccess(EventResult& eventResult) override;
75  virtual bool onFailure(EventResult& eventResult) override;
76 
77  //[-------------------------------------------------------]
78  //[ Points evaluation ]
79  //[-------------------------------------------------------]
80  virtual uint32 calculatePointGain(EventResult& eventResult) override;
81 
82  //[-------------------------------------------------------]
83  //[ Callbacks from observers ]
84  //[-------------------------------------------------------]
85  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
86  virtual void hintCallback(Observer& hintObserver) override;
87 
88  //[-------------------------------------------------------]
89  //[ Timers ]
90  //[-------------------------------------------------------]
91  virtual void onTimerTriggered(uint32 timerId) override;
92 
93  //[-------------------------------------------------------]
94  //[ Miscellaneous ]
95  //[-------------------------------------------------------]
96  virtual const qsf::Entity* getFocusEntity() override;
97 
98  //[-------------------------------------------------------]
99  //[ Serialize ]
100  //[-------------------------------------------------------]
101  virtual void serialize(qsf::BinarySerializer& serializer) override;
102 
103 
104  //[-------------------------------------------------------]
105  //[ Protected virtual em5::MainEvent methods ]
106  //[-------------------------------------------------------]
107  protected:
108  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
109 
110  //[-------------------------------------------------------]
111  //[ Regular update ]
112  //[-------------------------------------------------------]
113  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
114 
115  virtual uint32 getEventNumber() override;
116 
117 
118  //[-------------------------------------------------------]
119  //[ Private definitions ]
120  //[-------------------------------------------------------]
121  private:
122  enum class CameraFlight
123  {
124  NONE,
126  };
127 
128 
129  //[-------------------------------------------------------]
130  //[ Private methods ]
131  //[-------------------------------------------------------]
132  private:
133  void setupScene();
134  void startObjectives();
135 
136  void onCameraFlightStopped(const qsf::MessageParameters& parameters);
137  void onCutsceneEvent(const qsf::MessageParameters& parameters);
138  void onCutsceneEnd(const qsf::MessageParameters& parameters);
139  void onCutsceneFinish(const qsf::MessageParameters& parameters);
140  void onGangsterWaypoint(const qsf::MessageParameters& parameters);
141  void onGangsterEscaped(const qsf::MessageParameters& parameters);
142 
143  void startCameraFlight(CameraFlight cameraFlight, qsf::Entity& targetEntity);
144  void startRace();
145 
146  void makeCarTowable(qsf::Entity& entity);
147  void enablePlayerUnitMovement(bool enable);
148 
149 
150  //[-------------------------------------------------------]
151  //[ Private data ]
152  //[-------------------------------------------------------]
153  private:
154  // Connected to CAMP
155  qsf::Time mTimeUntilRaceStarts;
156 
157  // Internal
158  qsf::WeakPtr<qsf::Entity> mTriggerBox;
159  qsf::WeakPtr<qsf::Entity> mMinimapArea;
160  qsf::WeakPtr<qsf::Entity> mCameraPositionForCutscene;
161  qsf::WeakPtr<qsf::Entity> mRacer01Car;
162  qsf::WeakPtr<qsf::Entity> mRacer02Car;
163  qsf::WeakPtr<qsf::Entity> mRacer02CarTarget;
164  qsf::WeakPtr<qsf::Entity> mRacer02;
165 
166  qsf::MessageProxy mCameraFlightStoppedMessageProxy;
167  qsf::MessageProxy mCutsceneEventMessageProxy;
168  qsf::MessageProxy mCutsceneEndMessageProxy;
169  qsf::MessageProxy mCutsceneFinishMessageProxy;
170  qsf::MessageProxy mGangsterWaypointMessageProxy;
171  qsf::MessageProxy mGangsterEscapedMessageProxy;
172 
173  CameraFlight mActiveCameraFlight;
174 
175 
176  //[-------------------------------------------------------]
177  //[ CAMP reflection system ]
178  //[-------------------------------------------------------]
179  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
180 
181 
182  };
183 
184 
185 //[-------------------------------------------------------]
186 //[ Namespace ]
187 //[-------------------------------------------------------]
188 } // em5
189 
190 
191 //[-------------------------------------------------------]
192 //[ CAMP reflection system ]
193 //[-------------------------------------------------------]
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent302" unique freeplay event ID
Definition: MainEvent302.h:44
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 serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
unsigned int uint32
Definition: PlatformTypes.h:181
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 onRun() override
React to state change from (initial) hidden state to running state.
virtual void onTimerTriggered(uint32 timerId) override
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
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 onShutdown() override
React to shutdown of the freeplay event.
virtual ~MainEvent302()
Destructor.
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 uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
EMERGENCY 20 years edition mission base class.
Definition: Em20MainEventBase.h:30
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
EMERGENCY 20 years edition mission 02 "Illegal Street Race".
Definition: MainEvent302.h:30
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 ...
MainEvent302()
Default constructor.
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
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