Emergency 20 Dokumentation  4.2.0
MainEvent310.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  MainEvent310();
56 
61  virtual ~MainEvent310();
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  //[ Miscellaneous ]
90  //[-------------------------------------------------------]
91  virtual const qsf::Entity* getFocusEntity() override;
92 
93  //[-------------------------------------------------------]
94  //[ Serialize ]
95  //[-------------------------------------------------------]
96  virtual void serialize(qsf::BinarySerializer& serializer) override;
97 
98 
99  //[-------------------------------------------------------]
100  //[ Protected virtual em5::MainEvent methods ]
101  //[-------------------------------------------------------]
102  protected:
103  //[-------------------------------------------------------]
104  //[ Regular update ]
105  //[-------------------------------------------------------]
106  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
107 
108  virtual uint32 getEventNumber() override;
109 
110 
111  //[-------------------------------------------------------]
112  //[ Protected virtual em5::Em20MainEventBase methods ]
113  //[-------------------------------------------------------]
114  protected:
115  virtual void onUnitSetup(qsf::Entity& entity, uint32 unitTypeId) override;
116 
117 
118  //[-------------------------------------------------------]
119  //[ Private methods ]
120  //[-------------------------------------------------------]
121  private:
122  void setupScene();
123  void startObjectives();
124 
125  void updateContamination(const qsf::Time& timePassed);
126 
127  void onCheckGuidePersonTarget(const qsf::MessageParameters& parameters);
128  void onPersonExitsAfterDecontamination(const qsf::MessageParameters& parameters);
129  void onPersonExitedAfterDecontamination(const qsf::MessageParameters& parameters);
130  void onPersonInjured(const qsf::MessageParameters& parameters);
131  void onObjectStartsBurning(const qsf::MessageParameters& parameters);
132  void onBusReadyForUnload(const qsf::MessageParameters& parameters);
133 
134 
135  //[-------------------------------------------------------]
136  //[ Private data ]
137  //[-------------------------------------------------------]
138  private:
139  // Connected to CAMP
140  qsf::Time mTimeForSlowContamination;
141  qsf::Time mTimeForFastContamination;
142 
143  // Internal
144  qsf::WeakPtr<qsf::Entity> mAreaFastContamination;
145  qsf::WeakPtr<qsf::Entity> mAreaSafeZone;
147  qsf::WeakPtr<qsf::Entity> mTentUnload;
148 
149  qsf::Time mTimeUntilNextContaminationUpdate;
150  boost::container::flat_map<uint64, float> mContaminationProgress; // Contamination progress in [0.0f, 1.0f] by entity ID
151 
152  qsf::MessageProxy mCheckGuidePersonTargetMessageProxy;
153  qsf::MessageProxy mPersonExitsAfterDecontaminationMessageProxy;
154  qsf::MessageProxy mPersonExitedAfterDecontaminationMessageProxy;
155  qsf::MessageProxy mPersonInjuredMessageProxy;
156  qsf::MessageProxy mObjectStartBurningMessageProxy;
157  qsf::MessageProxy mBusReadyForUnloadMessageProxy;
158 
159 
160  //[-------------------------------------------------------]
161  //[ CAMP reflection system ]
162  //[-------------------------------------------------------]
163  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
164 
165 
166  };
167 
168 
169 //[-------------------------------------------------------]
170 //[ Namespace ]
171 //[-------------------------------------------------------]
172 } // em5
173 
174 
175 //[-------------------------------------------------------]
176 //[ CAMP reflection system ]
177 //[-------------------------------------------------------]
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
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent310" unique freeplay event ID
Definition: MainEvent310.h:44
virtual bool onStartup() override
React to startup of the freeplay event.
unsigned int uint32
Definition: PlatformTypes.h:181
virtual void onUnitSetup(qsf::Entity &entity, uint32 unitTypeId) override
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
virtual void onRun() override
React to state change from (initial) hidden state to running state.
virtual ~MainEvent310()
Destructor.
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
EMERGENCY 20 years edition mission 10 "Nuclear Power Plant".
Definition: MainEvent310.h:30
#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
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
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...
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
MainEvent310()
Default constructor.
Binary serializer class.
Definition: BinarySerializer.h:35
virtual void onShutdown() override
React to shutdown of the freeplay event.
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
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 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.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32