Emergency 20 Dokumentation  4.2.0
MainEvent305.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  MainEvent305();
56 
61  virtual ~MainEvent305();
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  //[-------------------------------------------------------]
109  //[ Regular update ]
110  //[-------------------------------------------------------]
111  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
112 
113  virtual uint32 getEventNumber() override;
114 
115 
116  //[-------------------------------------------------------]
117  //[ Private methods ]
118  //[-------------------------------------------------------]
119  private:
120  void setupScene();
121  void startObjectives();
122 
123  void onUnitSpawn(const qsf::MessageParameters& parameters);
124  void onCheckBoatTarget(const qsf::MessageParameters& parameters);
125  void onObjectStartsBurning(const qsf::MessageParameters& parameters);
126  void onBuriedFound(const qsf::MessageParameters& parameters);
127  void onPersonPlacedInHeli(const qsf::MessageParameters& parameters);
128  void onCutsceneFinished(const qsf::MessageParameters& parameters);
129 
130  void makeDrowningPerson(qsf::Entity& entity);
131 
132 
133  //[-------------------------------------------------------]
134  //[ Private data ]
135  //[-------------------------------------------------------]
136  private:
137  // Connected to CAMP
138  float mFireboatMoveSpeed;
139  float mFireboatAcceleration;
140  float mFireboatRange;
141  qsf::Time mDelayForBurnDelayed;
142 
143  // Internal
144  float mOriginalFireboatRange;
145 
146  struct Sailor
147  {
149  };
150  struct ShipPart
151  {
152  uint32 mNumber = 0;
154  std::vector<Sailor> mSailors;
155  bool mBurning = false;
156  };
157  std::vector<ShipPart> mShipParts;
158 
159  qsf::MessageProxy mUnitSpawnMessageProxy;
160  qsf::MessageProxy mCheckBoatTargetMessageProxy;
161  qsf::MessageProxy mObjectStartsBurningMessageProxy;
162  qsf::MessageProxy mBuriedFoundMessageProxy;
163  qsf::MessageProxy mPersonPlacedInHeliMessageProxy;
164  qsf::MessageProxy mCutsceneFinishedMessageProxy;
165 
166 
167  //[-------------------------------------------------------]
168  //[ CAMP reflection system ]
169  //[-------------------------------------------------------]
170  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
171 
172 
173  };
174 
175 
176 //[-------------------------------------------------------]
177 //[ Namespace ]
178 //[-------------------------------------------------------]
179 } // em5
180 
181 
182 //[-------------------------------------------------------]
183 //[ CAMP reflection system ]
184 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
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
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 ~MainEvent305()
Destructor.
EMERGENCY 20 years edition mission 05 "Supertanker".
Definition: MainEvent305.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.
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 onShutdown() override
React to shutdown of the freeplay event.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent305" unique freeplay event ID
Definition: MainEvent305.h:44
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
#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
MainEvent305()
Default constructor.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
Binary serializer class.
Definition: BinarySerializer.h:35
virtual void onTimerTriggered(uint32 timerId) override
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 ...
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32