Emergency 20 Dokumentation  4.2.0
DemonstrationEvent.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 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace qsf
22 {
23  class Layer;
24 }
25 
26 
27 //[-------------------------------------------------------]
28 //[ Namespace ]
29 //[-------------------------------------------------------]
30 namespace em5
31 {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Classes ]
36  //[-------------------------------------------------------]
42  {
43 
44 
45  //[-------------------------------------------------------]
46  //[ Public definitions ]
47  //[-------------------------------------------------------]
48  public:
49  static const uint32 FREEPLAY_EVENT_ID;
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public static methods ]
54  //[-------------------------------------------------------]
55  public:
60  static bool canSpawnEntitiesCollisionFree(const qsf::Layer& layer, qsf::Map& map);
61 
62 
63  //[-------------------------------------------------------]
64  //[ Public methods ]
65  //[-------------------------------------------------------]
66  public:
72 
77  virtual ~DemonstrationEvent();
78 
86  void init(qsf::Layer* demonstrationLayer);
87 
92  float getDemonstrationRadius() const;
93  void setDemonstrationRadius(float radius);
94  uint32 getGangsterNumber() const;
95  void setGangsterNumber(uint32 gangsterNumber);
96  qsf::Time getTimeoutDelay() const;
97  void setTimeoutDelay(qsf::Time timeout);
98  uint32 getMaximalProtester() const;
99  void setMaximalProtester(uint32 maximalProtester);
100 
101  //[-------------------------------------------------------]
102  //[ Public virtual em5::FreeplayEvent methods ]
103  //[-------------------------------------------------------]
104  public:
105  virtual bool onStartup() override;
106  virtual void onShutdown() override;
107  virtual void onRun() override;
108  virtual bool onFailure(EventResult& eventResult) override;
109  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
110  virtual void hintCallback(Observer& hintObserver) override;
111  virtual const qsf::Entity* getFocusEntity() override;
112  virtual bool checkEventConfiguration() override;
113  virtual void serialize(qsf::BinarySerializer& serializer) override;
114 
115 
116  //[-------------------------------------------------------]
117  //[ Private methods ]
118  //[-------------------------------------------------------]
119  private:
120  void setupScene(qsf::Layer& demonstrationLayer);
121  void startHintObservers();
122  void onShowHint01(const qsf::MessageParameters& parameters);
123 
124 
125  //[-------------------------------------------------------]
126  //[ Private data ]
127  //[-------------------------------------------------------]
128  private:
129  uint32 mDemonstrationLayerId;
130  std::vector<uint64> mCenterEntityIds;
131  float mDemonstrationRadius;
132  uint32 mGangsterNumber;
133  qsf::Time mTimeoutDelay;
134  uint32 mMaximalProtester;
135  qsf::WeakPtr<qsf::Entity> mSoundEntity;
136 
137  // internal
138  uint32 mProtesterNumber;
139  std::vector<bool> mCenterTurnedViolent; // TODO(co) Would a bitset be sufficient in here?
140  qsf::MessageConfiguration mTimerMessage;
141  qsf::MessageProxy mDelayHint01TimerMessageProxy;
142 
143 
144  //[-------------------------------------------------------]
145  //[ CAMP reflection system ]
146  //[-------------------------------------------------------]
147  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
148 
149 
150  };
151 
152 
153 //[-------------------------------------------------------]
154 //[ Namespace ]
155 //[-------------------------------------------------------]
156 } // em5
157 
158 
159 //[-------------------------------------------------------]
160 //[ CAMP reflection system ]
161 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
EMERGENCY 5 freeplay event class for the demonstration event.
Definition: DemonstrationEvent.h:41
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
Map class.
Definition: Map.h:93
Layer class.
Definition: Layer.h:56
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
static const uint32 FREEPLAY_EVENT_ID
"em5::DemonstrationEvent" unique freeplay event ID
Definition: DemonstrationEvent.h:49
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
#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
Message configuration class.
Definition: MessageConfiguration.h:44
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