Emergency 20 Dokumentation  4.2.0
DemonstrationMobEvent.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 
16 #include <qsf/base/WeakPtr.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26  class BuildingComponent;
27  class BlockAreaWithUnits;
28  class WarblerTweetHelper;
29 }
30 
31 
32 //[-------------------------------------------------------]
33 //[ Namespace ]
34 //[-------------------------------------------------------]
35 namespace em5
36 {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Classes ]
41  //[-------------------------------------------------------]
47  {
48 
49 
50  //[-------------------------------------------------------]
51  //[ Friends ]
52  //[-------------------------------------------------------]
53  friend class FreeplayEventMetaclasses2; // CAMP export of editable values for Game Design
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public definitions ]
58  //[-------------------------------------------------------]
59  public:
60  static const uint32 FREEPLAY_EVENT_ID;
61 
62 
63  //[-------------------------------------------------------]
64  //[ Public methods ]
65  //[-------------------------------------------------------]
66  public:
72 
77  virtual ~DemonstrationMobEvent();
78 
79 
80  //[-------------------------------------------------------]
81  //[ Public virtual em5::FreeplayEvent methods ]
82  //[-------------------------------------------------------]
83  public:
84  virtual bool onStartup() override;
85  virtual void onShutdown() override;
86  virtual void onRun() override;
87  virtual bool onFailure(EventResult& eventResult) override;
88  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
89  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
90  virtual void hintCallback(Observer& hintObserver) override;
91  virtual const qsf::Entity* getFocusEntity() override;
92  virtual bool checkEventConfiguration() override;
93  virtual void serialize(qsf::BinarySerializer& serializer) override;
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private methods ]
98  //[-------------------------------------------------------]
99  private:
100  void setupScene();
101  void startObjectives();
102  void startHintObservers();
103 
104  void onGameTimerMessage(const qsf::MessageParameters& parameters);
105  void onPersonArrestedOrInjured(const qsf::MessageParameters& parameters);
106 
107  void startExtremists();
108  void startNextExtremist();
109  void triggerArsonists();
110 
111 
112  //[-------------------------------------------------------]
113  //[ Private data ]
114  //[-------------------------------------------------------]
115  private:
116  // Configuration
117  float mTimeToSecureDemo; // In seconds, we don't use "qsf::Time" for direct connection to an editable property in event JSON
118  uint32 mBurningObjectsToFail;
119  uint32 mInactiveExtremistsToTriggerArsonists;
120 
121  // Event entities
122  std::vector<qsf::WeakPtr<qsf::Entity>> mWaitingExtremists;
123  std::vector<qsf::WeakPtr<qsf::Entity>> mStartedExtremists;
124  std::vector<qsf::WeakPtr<qsf::Entity>> mArsonists;
125  qsf::WeakPtr<qsf::Entity> mHouseFire01;
126 
127  BlockAreaWithUnits& mBlockAreaWithUnits;
128 
129  // Warbler tweet
130  WarblerTweetHelper& mTweet01;
131  WarblerTweetHelper& mTweet02;
132  bool mTweet02TimerStarted;
133 
134  // Messages
135  qsf::MessageProxy mGameTimerMessageProxy;
136  qsf::MessageProxy mPersonArrestedMessageProxy;
137  qsf::MessageProxy mPersonInjuredMessageProxy;
138 
139  enum State
140  {
141  STATE_SECURE_DEMO,
142  STATE_STOP_EXTREMISTS,
143  STATE_STOP_ALL
144  };
145  State mState;
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
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
Utility class for events when user has to block areas with his units.
Definition: BlockAreaWithUnits.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
Emergency 2017 mini-event "Hamburg demonstration".
Definition: DemonstrationMobEvent.h:46
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
Static CAMP freeplay event plugin metaclass collection class.
Definition: FreeplayEventMetaclasses2.h:30
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
State
Definition: ProcessState.h:20
Helper class for warbler tweets.
Definition: WarblerTweetHelper.h:41
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
static const uint32 FREEPLAY_EVENT_ID
"em5::DemonstrationMobEvent" unique main event ID
Definition: DemonstrationMobEvent.h:60
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
Binary serializer class.
Definition: BinarySerializer.h:35
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32