Emergency 20 Dokumentation  4.2.0
BuildingProtectionEvent.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>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  class BlockAreaWithUnits;
26  class WarblerTweetHelper;
27 }
28 
29 
30 //[-------------------------------------------------------]
31 //[ Namespace ]
32 //[-------------------------------------------------------]
33 namespace em5
34 {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Classes ]
39  //[-------------------------------------------------------]
45  {
46 
47 
48  //[-------------------------------------------------------]
49  //[ Friends ]
50  //[-------------------------------------------------------]
51  friend class FreeplayEventMetaclasses2; // CAMP export of editable values for Game Design
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public definitions ]
56  //[-------------------------------------------------------]
57  public:
58  static const uint32 FREEPLAY_EVENT_ID;
59 
60 
61  //[-------------------------------------------------------]
62  //[ Public methods ]
63  //[-------------------------------------------------------]
64  public:
70 
75  virtual ~BuildingProtectionEvent();
76 
77 
78  //[-------------------------------------------------------]
79  //[ Public virtual em5::FreeplayEvent methods ]
80  //[-------------------------------------------------------]
81  public:
82  virtual bool onStartup() override;
83  virtual void onShutdown() override;
84  virtual void onRun() override;
85  virtual bool onFailure(EventResult& eventResult) override;
86  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
87  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
88  virtual void hintCallback(Observer& hintObserver) override;
89  virtual const qsf::Entity* getFocusEntity() override;
90  virtual bool checkEventConfiguration() override;
91  virtual void serialize(qsf::BinarySerializer& serializer) override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Private methods ]
96  //[-------------------------------------------------------]
97  private:
98  void setupScene();
99  void startObjectives();
100  void startHintObservers();
101 
102  void onPoliceDogFoundObject(const qsf::MessageParameters& parameters);
103  void onHiddenGangsterFound(const qsf::MessageParameters& parameters);
104 
105  void unlockTerrorCar();
106  void spawnTerrorists();
107  qsf::Entity& spawnTerrorist(qsf::Entity& spawnpoint);
108  void letTerroristsFlee(uint64 alreadyFoundEntityId);
109 
110 
111  //[-------------------------------------------------------]
112  //[ Private data ]
113  //[-------------------------------------------------------]
114  private:
115  // Configuration
116  qsf::Time mBombTimer;
117  qsf::Time mTimeToDefuseBomb;
118 
119  // Event entities
120  qsf::WeakPtr<qsf::Entity> mEventArea;
121  qsf::WeakPtr<qsf::Entity> mTerrorCar;
123  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristSpawnPoints;
124  std::vector<qsf::WeakPtr<qsf::Entity>> mTerrorists;
125  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristWaypoints;
126 
127  struct GaperInfo
128  {
130  bool mInsideBox = false;
131  };
132  std::vector<GaperInfo> mGapers;
133 
134  BlockAreaWithUnits& mBlockAreaWithUnits;
135 
136  // Warbler tweet
137  WarblerTweetHelper& mTweet01;
138 
139  // Event state
140  enum class TerrorCarState
141  {
142  NO_INTERACTION,
143  CAN_BE_INVESTIGATED,
144  BOMB_PLACED
145  };
146  TerrorCarState mTerrorCarState;
147 
148  // Messages
149  qsf::MessageProxy mDogFoundObjectMessageProxy;
150  qsf::MessageProxy mVehicleCutOpenMessageProxy;
151  qsf::MessageProxy mHiddenGangsterFoundMessageProxy;
152 
153 
154  //[-------------------------------------------------------]
155  //[ CAMP reflection system ]
156  //[-------------------------------------------------------]
157  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
158 
159 
160  };
161 
162 
163 //[-------------------------------------------------------]
164 //[ Namespace ]
165 //[-------------------------------------------------------]
166 } // em5
167 
168 
169 //[-------------------------------------------------------]
170 //[ CAMP reflection system ]
171 //[-------------------------------------------------------]
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
#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
static const uint32 FREEPLAY_EVENT_ID
"em5::BuildingProtectionEvent" unique main event ID
Definition: BuildingProtectionEvent.h:58
Emergency 2017 mini-event "Berlin Reichtag building protection".
Definition: BuildingProtectionEvent.h:44
uint64_t uint64
Definition: PlatformTypes.h:184
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
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
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