Emergency 20 Dokumentation  4.2.0
SabotageEvent.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 #include <qsf/base/WeakPtr.h>
17 #include <qsf/map/Entity.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class Layer;
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Classes ]
38  //[-------------------------------------------------------]
44  {
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public definitions ]
49  //[-------------------------------------------------------]
50  public:
51  static const uint32 FREEPLAY_EVENT_ID;
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public methods ]
56  //[-------------------------------------------------------]
57  public:
62  SabotageEvent();
63 
68  virtual ~SabotageEvent();
69 
70  void init(qsf::Layer& eventLayer);
71 
72 
73  //[-------------------------------------------------------]
74  //[ Public virtual em5::FreeplayEvent methods ]
75  //[-------------------------------------------------------]
76  public:
77  virtual bool onStartup() override;
78  virtual void onShutdown() override;
79  virtual void onRun() override;
80  virtual bool onFailure(EventResult& eventResult) override;
81  virtual bool onSuccess(EventResult& eventResult) override;
82  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
83  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
84  virtual const qsf::Entity* getFocusEntity() override;
85  virtual bool checkEventConfiguration() override;
86  virtual void serialize(qsf::BinarySerializer& serializer) override;
87  virtual void hintCallback(Observer& hintObserver) override;
88 
89 
90  //[-------------------------------------------------------]
91  //[ Private methods ]
92  //[-------------------------------------------------------]
93  private:
94  void startObjectives();
95  bool getSubLayerFromMainLayer(qsf::Layer& mainLayer);
96  void setupScene();
97 
98  void onDroneFoundGangster(const qsf::MessageParameters& parameters);
99 
100  void onBuriedFound(const qsf::MessageParameters& parameters);
101 
102  void pushMoveToEscapePoint(qsf::Entity& entity);
103  qsf::Entity* getEscapePointById(int escapePointIndex);
104 
105 
106  //[-------------------------------------------------------]
107  //[ Private data ]
108  //[-------------------------------------------------------]
109  private:
110  // Settings
111  std::string mGangsterLogicName;
112 
113  // Setup
114  uint32 mEventLayerId;
115 
116  // Internal
117  qsf::Layer* mEventLayer;
118  qsf::Layer* mEraseLayer;
119 
120  bool mIsGangsterHidden;
121  std::vector<qsf::WeakPtr<qsf::Entity>> mCivilEscapePersons;
122  std::vector<qsf::WeakPtr<qsf::Entity>> mCivilEscapePoints;
123  qsf::WeakPtr<qsf::Entity> mStageEntity;
124  qsf::WeakPtr<qsf::Entity> mTweetCameraEntity;
125  qsf::WeakPtr<qsf::Entity> mTweetDebrisEntity;
126  qsf::WeakPtr<qsf::Entity> mTweetPersonEntity;
127  bool mCanTweet;
128  bool mHasTweeted;
129  qsf::Time mTimeTillTweet; // Put a delay of one frame to the tweet to have a valid animation position
130  int mNumberPersonsTillTweet;
131  std::vector<uint64> mAllReadyFoundPersonsIds;
132 
133  struct StartEscaping
134  {
135  StartEscaping(qsf::Entity& entity, qsf::Time escapeTime) : mEscapeEntity(&entity), mTimeTillEscape(escapeTime), mStarted(false), mRemovedInvincible(false) { }
136 
137  bool mStarted;
138  bool mRemovedInvincible;
139  qsf::WeakPtr<qsf::Entity> mEscapeEntity;
140  qsf::Time mTimeTillEscape;
141  };
142  std::vector<StartEscaping> mStartEscaping;
143 
144  qsf::MessageProxy mGangsterFoundMessageProxy;
145  qsf::MessageProxy mBuriedFoundMessageProxy;
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
EMERGENCY 5 freeplay event "Sabotage".
Definition: SabotageEvent.h:43
Layer class.
Definition: Layer.h:56
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
static const uint32 FREEPLAY_EVENT_ID
"em5::SabotageEvent" unique freeplay event ID
Definition: SabotageEvent.h:51
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
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
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