Emergency 20 Dokumentation  4.2.0
MainEvent309.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  MainEvent309();
58 
63  virtual ~MainEvent309();
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  //[-------------------------------------------------------]
111  //[ Regular update ]
112  //[-------------------------------------------------------]
113  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
114 
115  virtual uint32 getEventNumber() override;
116 
117 
118  //[-------------------------------------------------------]
119  //[ Private methods ]
120  //[-------------------------------------------------------]
121  private:
122  void setupScene();
123  void startObjectives();
124 
125  void onCameraFlightStopped(const qsf::MessageParameters& parameters);
126  void onEboxRepaired(const qsf::MessageParameters& parameters);
127 
128 
129  //[-------------------------------------------------------]
130  //[ Private data ]
131  //[-------------------------------------------------------]
132  private:
133  // Connected to CAMP
134  qsf::Time mEboxUseTime;
135  qsf::Time mTimeUntilDeathZoneBig;
136 
137  // Internal
139  qsf::WeakPtr<qsf::Entity> mDeathZoneSmall;
140  qsf::WeakPtr<qsf::Entity> mDeathZoneBig;
141  qsf::WeakPtr<qsf::Entity> mDeathZoneCamera;
142  qsf::WeakPtr<qsf::Entity> mDeathZoneSparks;
143  std::vector<qsf::WeakPtr<qsf::Entity>> mDeathZonePersonParticles;
144  qsf::WeakPtr<qsf::Entity> mCraneBlock;
145 
146  qsf::MessageProxy mCameraFlightStoppedMessageProxy;
147  qsf::MessageProxy mRepairEboxMessageProxy;
148 
149  enum class DeathZoneState
150  {
151  ACTIVE_SMALL,
152  ACTIVE_BIG,
153  DISABLED
154  };
155  DeathZoneState mDeathZoneState;
156  qsf::AudioProxy mDeathZoneAudioProxy;
157 
158 
159  //[-------------------------------------------------------]
160  //[ CAMP reflection system ]
161  //[-------------------------------------------------------]
162  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
163 
164 
165  };
166 
167 
168 //[-------------------------------------------------------]
169 //[ Namespace ]
170 //[-------------------------------------------------------]
171 } // em5
172 
173 
174 //[-------------------------------------------------------]
175 //[ CAMP reflection system ]
176 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
virtual void onShutdown() override
React to shutdown 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.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
virtual ~MainEvent309()
Destructor.
unsigned int uint32
Definition: PlatformTypes.h:181
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
EMERGENCY 20 years edition mission 09 "Avalanche".
Definition: MainEvent309.h:32
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.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual void onTimerTriggered(uint32 timerId) override
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent309" unique freeplay event ID
Definition: MainEvent309.h:46
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
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
EMERGENCY 20 years edition mission base class.
Definition: Em20MainEventBase.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 ...
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
MainEvent309()
Default constructor.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
Binary serializer class.
Definition: BinarySerializer.h:35
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 hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32