Emergency 20 Dokumentation  4.2.0
PillageBuildingEvent.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 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace qsf
23 {
24  class Transform;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
50  static const uint32 FREEPLAY_EVENT_ID;
51 
52 
53  //[-------------------------------------------------------]
54  //[ Public methods ]
55  //[-------------------------------------------------------]
56  public:
62 
67  virtual ~PillageBuildingEvent();
68 
76  void init(qsf::Entity& targetBuilding);
77 
78  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(GangsterInsideBuilding, int, mGangsterInsideBuilding)
79  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(GangsterOutsideBuilding, int, mGangsterOutsideBuilding)
80  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(FailAttackBuildingTime, qsf::Time, mFailAttackBuildingTimer);
81 
82  void setAmbientLayerName(const std::string& layerName);
83 
84  void setGangsterLogicName(const std::string& gangsterLogicName);
85  const std::string& getGangsterLogicName() const;
86 
87 
88  //[-------------------------------------------------------]
89  //[ Public virtual em5::FreeplayEvent methods ]
90  //[-------------------------------------------------------]
91  public:
92  virtual bool onStartup() override;
93  virtual void onShutdown() override;
94  virtual void onRun() override;
95  virtual bool onFailure(EventResult& eventResult) override;
96  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
97  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
98  virtual void hintCallback(Observer& hintObserver) override;
99  virtual bool checkEventConfiguration() override;
100  virtual const qsf::Entity* getFocusEntity() override;
101  virtual void serialize(qsf::BinarySerializer& serializer) override;
102 
103 
104  //[-------------------------------------------------------]
105  //[ Private methods ]
106  //[-------------------------------------------------------]
107  private:
108  void onAttackBuilding(const qsf::MessageParameters& parameters);
109  void spawnGangsterOutsideBuilding(const qsf::Transform& spawnPosition, int gangsterIndex);
110 
111 
112  //[-------------------------------------------------------]
113  //[ Private data ]
114  //[-------------------------------------------------------]
115  private:
116  qsf::WeakPtr<qsf::Entity> mTargetBuilding;
117  qsf::MessageProxy mAttackBuildingFinishedMessageProxy;
118 
119  int mGangsterInsideBuilding;
120  int mGangsterOutsideBuilding;
121  std::string mGangsterLogicName;
122  std::string mAmbientLayerName;
123 
124  // Event fail
125  bool mGangsterInBuilding;
126  qsf::Time mFailAttackBuildingTimer;
127 
128 
129  //[-------------------------------------------------------]
130  //[ CAMP reflection system ]
131  //[-------------------------------------------------------]
132  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
133 
134 
135  };
136 
137 
138 //[-------------------------------------------------------]
139 //[ Namespace ]
140 //[-------------------------------------------------------]
141 } // em5
142 
143 
144 //[-------------------------------------------------------]
145 //[ CAMP reflection system ]
146 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: AreaConfiguration.h:58
EMERGENCY 5 freeplay event "pillage building event".
Definition: PillageBuildingEvent.h:42
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
static const uint32 FREEPLAY_EVENT_ID
"em5::PillageBuildingEvent" unique freeplay event ID
Definition: PillageBuildingEvent.h:50
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
#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