Emergency 20 Dokumentation  4.2.0
ManhuntEvent.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 em5
23 {
24  class WarblerTweetHelper;
25 }
26 namespace qsf
27 {
28  class Layer;
29 }
30 
31 
32 //[-------------------------------------------------------]
33 //[ Namespace ]
34 //[-------------------------------------------------------]
35 namespace em5
36 {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Classes ]
41  //[-------------------------------------------------------]
47  {
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public definitions ]
52  //[-------------------------------------------------------]
53  public:
54  static const uint32 FREEPLAY_EVENT_ID;
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public static methods ]
59  //[-------------------------------------------------------]
60  public:
65  static const std::string getHouseEventagFromEventLayerName(const std::string& layerName);
66 
67 
68  //[-------------------------------------------------------]
69  //[ Public methods ]
70  //[-------------------------------------------------------]
71  public:
76  ManhuntEvent();
77 
82  virtual ~ManhuntEvent();
83 
84  void init(qsf::Layer& eventLayer);
85 
86  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(TimeTillEventLose, qsf::Time, mTimeTillEventLose);
87 
88 
89  //[-------------------------------------------------------]
90  //[ Public virtual em5::FreeplayEvent methods ]
91  //[-------------------------------------------------------]
92  public:
93  virtual bool onStartup() override;
94  virtual void onShutdown() override;
95  virtual void onRun() override;
96  virtual bool onFailure(EventResult& eventResult) override;
97  virtual bool onSuccess(EventResult& eventResult) override;
98  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
99  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
100  virtual const qsf::Entity* getFocusEntity() override;
101  virtual bool checkEventConfiguration() override;
102  virtual void serialize(qsf::BinarySerializer& serializer) override;
103  virtual void hintCallback(Observer& hintObserver) override;
104 
105 
106  //[-------------------------------------------------------]
107  //[ Private methods ]
108  //[-------------------------------------------------------]
109  private:
110  void startObjectives();
111  void setupScene();
112 
113  void setupGangsterHouses();
114  void setupGangsterHouse(qsf::Entity& houseEntity, bool isFakeObject);
115  void removeRandomFakeBuilding();
116  void removeFakeBuildingIcons(qsf::Entity& houseEntity);
117  void checkFalseHouseEmpty();
118 
119  void onSpeakToPerson(const qsf::MessageParameters& parameters);
120  void onAttackBuilding(const qsf::MessageParameters& parameters);
121 
122 
123  //[-------------------------------------------------------]
124  //[ Private data ]
125  //[-------------------------------------------------------]
126  private:
127  qsf::Layer* mEventLayer;
128  qsf::Layer* mEventSceneryLayer;
129  qsf::Layer* mEventEraseLayer;
130 
131  std::vector<qsf::WeakPtr<qsf::Entity>> mAttestors; // Persons the player has to talk
132  std::vector<qsf::WeakPtr<qsf::Entity>> mFalseHouses; // Houses with false flag
133  qsf::WeakPtr<qsf::Entity> mGangsterHouse;
134 
135  // Settings
136  qsf::Time mTimeTillEventLose;
137 
138  // States
139  bool mCanSetupGangsterHouses; // Indicator for event started
140  bool mFoundRightHouse;
141  qsf::MessageProxy mSpeakToPersonMessageProxy;
142  qsf::MessageProxy mAttackBuildingMessageProxy;
143  qsf::MessageProxy mAttackBuildingFakeMessageProxy;
144  bool mCanTriggerHint02; // Hint for attacking false house
145 
146  WarblerTweetHelper& mWarblerTweetHelper; // To support the delayed hints, we need an instance of the warbler tweet helper (for the update)
147 
148  std::vector<uint64> mAttackedBuildings;
149  int mNumberAttackedFalseHouses;
150 
151 
152  //[-------------------------------------------------------]
153  //[ CAMP reflection system ]
154  //[-------------------------------------------------------]
155  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
156 
157 
158  };
159 
160 
161 //[-------------------------------------------------------]
162 //[ Namespace ]
163 //[-------------------------------------------------------]
164 } // em5
165 
166 
167 //[-------------------------------------------------------]
168 //[ CAMP reflection system ]
169 //[-------------------------------------------------------]
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
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
Reason
Definition: EventSpreadReason.h:20
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
static const uint32 FREEPLAY_EVENT_ID
"em5::ManhuntEvent" unique freeplay event ID
Definition: ManhuntEvent.h:54
Definition: PickupPersonByParamedicAction.h:21
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
#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
EMERGENCY 5 freeplay event "Manhunt".
Definition: ManhuntEvent.h:46
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