Emergency 20 Dokumentation  4.2.0
HostagesEvent.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>
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public definitions ]
38  //[-------------------------------------------------------]
39  public:
40  static const uint32 FREEPLAY_EVENT_ID;
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public methods ]
45  //[-------------------------------------------------------]
46  public:
51  HostagesEvent();
52 
57  virtual ~HostagesEvent();
58 
63  void init(qsf::Entity& entity, bool gangsterGiveUp, const std::string& layerName);
64 
65  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(GangsterInsideBuildingAmount, int, mGangsterInsideBuildingAmount);
66  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(HostagesAmount, int, mHostagesAmount);
67  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(InjuredHostageAmount, int, mInjuredHostageAmount);
68  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(GangsterLogicName, const std::string&, mGangsterLogicName);
69  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(HostageSpawnPool, const std::string&, mHostageSpawnPool);
70 
71 
72  //[-------------------------------------------------------]
73  //[ Public virtual em5::FreeplayEvent methods ]
74  //[-------------------------------------------------------]
75  public:
76  virtual bool onStartup() override;
77  virtual void onShutdown() override;
78  virtual void onRun() override;
79  virtual bool onFailure(EventResult& eventResult) override;
80  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
81  virtual void hintCallback(Observer& hintObserver) override;
82  virtual const qsf::Entity* getFocusEntity() override;
83  virtual bool checkEventConfiguration() override;
84  virtual void serialize(qsf::BinarySerializer& serializer) override;
85 
86 
87  //[-------------------------------------------------------]
88  //[ Private methods ]
89  //[-------------------------------------------------------]
90  private:
91  void startHintObservers();
92 
93 
94  //[-------------------------------------------------------]
95  //[ Private data ]
96  //[-------------------------------------------------------]
97  private:
98  std::vector<uint64> mGangsterIds;
99  std::vector<uint64> mVictimIds;
100  qsf::WeakPtr<qsf::Entity> mTargetBuilding;
101 
102  // Configuration
103  int mGangsterInsideBuildingAmount;
104  int mHostagesAmount;
105  int mInjuredHostageAmount;
106  bool mGangsterGiveUp;
107  std::string mGangsterLogicName;
108  std::string mHostageSpawnPool;
109  std::string mLayerName;
110 
111 
112  //[-------------------------------------------------------]
113  //[ CAMP reflection system ]
114  //[-------------------------------------------------------]
115  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
116 
117 
118  };
119 
120 
121 //[-------------------------------------------------------]
122 //[ Namespace ]
123 //[-------------------------------------------------------]
124 } // em5
125 
126 
127 //[-------------------------------------------------------]
128 //[ CAMP reflection system ]
129 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Entity class.
Definition: Entity.h:46
static const uint32 FREEPLAY_EVENT_ID
"em5::HostagesEvent" unique freeplay event ID
Definition: HostagesEvent.h:40
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
#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
EMERGENCY 5 freeplay event class for "Hostages".
Definition: HostagesEvent.h:32
#define QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(name, type, variable)
Definition: PropertyHelper.h:16
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