Emergency 20 Dokumentation  4.2.0
MainEvent304.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  MainEvent304();
56 
61  virtual ~MainEvent304();
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 onUpdateMainEvent(const qsf::Time& timePassed) override;
109 
110  virtual uint32 getEventNumber() override;
111 
112 
113  //[-------------------------------------------------------]
114  //[ Private methods ]
115  //[-------------------------------------------------------]
116  private:
117  void setupScene();
118  void startObjectives();
119 
120  void onEboxRepaired(const qsf::MessageParameters& parameters);
121 
122  void switchTrafficLight(bool setGreen);
123 
124 
125  //[-------------------------------------------------------]
126  //[ Private data ]
127  //[-------------------------------------------------------]
128  private:
129  // Connected to CAMP
130  qsf::Time mEboxUseTime;
131  qsf::Time mTimeUntilHint01;
132 
133  // Internal
135  qsf::WeakPtr<qsf::Entity> mTrafficLightController;
136  qsf::WeakPtr<qsf::Entity> mAreaEvacuate;
137 
138  struct Evacuate
139  {
141  bool mIsInsideArea = false;
142  };
143  std::vector<Evacuate> mPersonsToEvacuate;
144 
145  qsf::MessageProxy mRepairEboxMessageProxy;
146 
147 
148  //[-------------------------------------------------------]
149  //[ CAMP reflection system ]
150  //[-------------------------------------------------------]
151  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
152 
153 
154  };
155 
156 
157 //[-------------------------------------------------------]
158 //[ Namespace ]
159 //[-------------------------------------------------------]
160 } // em5
161 
162 
163 //[-------------------------------------------------------]
164 //[ CAMP reflection system ]
165 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
virtual void onShutdown() override
React to shutdown of the freeplay event.
virtual void onRun() override
React to state change from (initial) hidden state to running state.
unsigned int uint32
Definition: PlatformTypes.h:181
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
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.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
virtual ~MainEvent304()
Destructor.
virtual void onTimerTriggered(uint32 timerId) override
#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
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent304" unique freeplay event ID
Definition: MainEvent304.h:44
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 serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
EMERGENCY 20 years edition mission 04 "Fog Accident".
Definition: MainEvent304.h:30
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 bool onStartup() override
React to startup of the freeplay event.
MainEvent304()
Default constructor.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32