Emergency 20 Dokumentation  4.2.0
MainEvent301.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 //[ Forward declarations ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21  class GangsterME301Arsonist;
22 }
23 
24 
25 //[-------------------------------------------------------]
26 //[ Namespace ]
27 //[-------------------------------------------------------]
28 namespace em5
29 {
30 
31 
32  //[-------------------------------------------------------]
33  //[ Classes ]
34  //[-------------------------------------------------------]
40  {
41 
42 
43  //[-------------------------------------------------------]
44  //[ Friends ]
45  //[-------------------------------------------------------]
46  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
47 
48 
49  //[-------------------------------------------------------]
50  //[ Public definitions ]
51  //[-------------------------------------------------------]
52  public:
53  static const uint32 FREEPLAY_EVENT_ID;
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public methods ]
58  //[-------------------------------------------------------]
59  public:
64  MainEvent301();
65 
70  virtual ~MainEvent301();
71 
72 
73  //[-------------------------------------------------------]
74  //[ Public virtual em5::FreeplayEvent methods ]
75  //[-------------------------------------------------------]
76  public:
77  //[-------------------------------------------------------]
78  //[ Lifecycle ]
79  //[-------------------------------------------------------]
80  virtual bool onStartup() override;
81  virtual void onShutdown() override;
82  virtual void onRun() override;
83  virtual bool onSuccess(EventResult& eventResult) override;
84  virtual bool onFailure(EventResult& eventResult) override;
85 
86  //[-------------------------------------------------------]
87  //[ Points evaluation ]
88  //[-------------------------------------------------------]
89  virtual uint32 calculatePointGain(EventResult& eventResult) override;
90 
91  //[-------------------------------------------------------]
92  //[ Callbacks from observers ]
93  //[-------------------------------------------------------]
94  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
95  virtual void hintCallback(Observer& hintObserver) override;
96 
97  //[-------------------------------------------------------]
98  //[ Timers ]
99  //[-------------------------------------------------------]
100  virtual void onTimerTriggered(uint32 timerId) override;
101 
102  //[-------------------------------------------------------]
103  //[ Miscellaneous ]
104  //[-------------------------------------------------------]
105  virtual const qsf::Entity* getFocusEntity() override;
106 
107  //[-------------------------------------------------------]
108  //[ Serialize ]
109  //[-------------------------------------------------------]
110  virtual void serialize(qsf::BinarySerializer& serializer) override;
111 
112 
113  //[-------------------------------------------------------]
114  //[ Protected virtual em5::MainEvent methods ]
115  //[-------------------------------------------------------]
116  protected:
117  //[-------------------------------------------------------]
118  //[ Regular update ]
119  //[-------------------------------------------------------]
120  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
121 
122  virtual uint32 getEventNumber() override;
123 
124 
125  //[-------------------------------------------------------]
126  //[ Private methods ]
127  //[-------------------------------------------------------]
128  private:
129  void setupScene();
130  void startObjectives();
131 
132  void onArsonistStartedFire(const qsf::MessageParameters& parameters);
133  void onPersonArrested(const qsf::MessageParameters& parameters);
134 
135 
136  //[-------------------------------------------------------]
137  //[ Private data ]
138  //[-------------------------------------------------------]
139  private:
140  // Connected to CAMP
141  qsf::Time mTimeToStartFirstFire;
142  qsf::Time mTimeToStartFire;
143  qsf::Time mFirefighterBuildingEvacuateTime;
144  uint32 mMaxBurningObjectsToStartFire;
145 
146  // Internal
147  qsf::WeakPtr<qsf::Entity> mArsonist;
149  bool mArsonistWasSighted;
150  uint32 mNumberOfFiresStarted;
151 
152  qsf::MessageProxy mFireStartedProxy;
153  qsf::MessageProxy mPersonArrestedMessageProxy;
154 
155 
156  //[-------------------------------------------------------]
157  //[ CAMP reflection system ]
158  //[-------------------------------------------------------]
159  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
160 
161 
162  };
163 
164 
165 //[-------------------------------------------------------]
166 //[ Namespace ]
167 //[-------------------------------------------------------]
168 } // em5
169 
170 
171 //[-------------------------------------------------------]
172 //[ CAMP reflection system ]
173 //[-------------------------------------------------------]
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.
virtual void onShutdown() override
React to shutdown of the freeplay event.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
virtual ~MainEvent301()
Destructor.
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
virtual bool onStartup() override
React to startup of the freeplay event.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent301" unique freeplay event ID
Definition: MainEvent301.h:53
unsigned int uint32
Definition: PlatformTypes.h:181
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
MainEvent301()
Default constructor.
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.
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
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
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 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual void onRun() override
React to state change from (initial) hidden state to running state.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
Binary serializer class.
Definition: BinarySerializer.h:35
virtual void onTimerTriggered(uint32 timerId) override
EMERGENCY 20 years edition mission 01 "Arsonist".
Definition: MainEvent301.h:39
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...
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32