Emergency 20 Dokumentation  4.2.0
WeaponDealEvent.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 Layer;
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 ~WeaponDealEvent();
68 
69  void init(qsf::Layer& eventLayer);
70 
71  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(GangsterTypeArmed, const std::string&, mGangsterTypeArmed)
72  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(GangsterTypeUnarmed, const std::string&, mGangsterTypeUnarmed)
73  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(DetectPoliceRadius, float, mDetectPoliceRadius)
74  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(DeadPersonsToFail, int, mDeadPersonsToFail)
75 
76 
77  //[-------------------------------------------------------]
78  //[ Public virtual em5::FreeplayEvent methods ]
79  //[-------------------------------------------------------]
80  public:
81  virtual bool onStartup() override;
82  virtual void onShutdown() override;
83  virtual void onRun() override;
84  virtual bool onFailure(EventResult& eventResult) override;
85  virtual bool onSuccess(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 const qsf::Entity* getFocusEntity() override;
89  virtual bool checkEventConfiguration() override;
90  virtual void serialize(qsf::BinarySerializer& serializer) override;
91  virtual void hintCallback(Observer& hintObserver) override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Private methods ]
96  //[-------------------------------------------------------]
97  private:
98  void startObjectives();
99  void setupScene();
100  void startPoliceArriving();
101  void setupGangster(qsf::Entity& gangsterEntity, std::string gangsterLogicName);
102 
103  void onWeaponFound(const qsf::MessageParameters& parameters);
104  void showEntityMesh(qsf::Entity& entity, bool active);
105  void showKicklight(bool active);
106 
107 
108  //[-------------------------------------------------------]
109  //[ Private data ]
110  //[-------------------------------------------------------]
111  private:
112  qsf::Layer* mEventLayer;
113 
114  qsf::WeakPtr<qsf::Entity> mGangsterCar;
115  qsf::WeakPtr<qsf::Entity> mWeaponObjectEntity;
116  std::vector<qsf::WeakPtr<qsf::Entity>> mArmedGangsters;
117  std::vector<qsf::WeakPtr<qsf::Entity>> mUnarmedGangsters;
118  qsf::WeakPtr<qsf::Entity> mTweetCameraEntity;
119  qsf::WeakPtr<qsf::Entity> mTweetPersonEntity;
120  qsf::WeakPtr<qsf::Entity> mTweetKickLightEntity;
121 
122  bool mCanMakeTweet;
123  bool mCanTurnOffLight;
124  qsf::Time mTweetDelay;
125 
126  // Settings
127  std::string mGangsterTypeArmed;
128  std::string mGangsterTypeUnarmed;
129  float mDetectPoliceRadius;
130  int mDeadPersonsToFail;
131 
132  // States
133  bool mPoliceArrived; // Indicator for event started
134  qsf::MessageProxy mFoundWeaponMessageProxy;
135  bool mWeaponfound;
136  bool mHint01Played;
137 
138 
139  //[-------------------------------------------------------]
140  //[ CAMP reflection system ]
141  //[-------------------------------------------------------]
142  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
143 
144 
145  };
146 
147 
148 //[-------------------------------------------------------]
149 //[ Namespace ]
150 //[-------------------------------------------------------]
151 } // em5
152 
153 
154 //[-------------------------------------------------------]
155 //[ CAMP reflection system ]
156 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
static const uint32 FREEPLAY_EVENT_ID
"em5::WeaponDealEvent" unique freeplay event ID
Definition: WeaponDealEvent.h:50
Layer class.
Definition: Layer.h:56
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: AreaConfiguration.h:58
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
EMERGENCY 5 freeplay event "weapon deal accident" (sometimes called drugdeal event) ...
Definition: WeaponDealEvent.h:42
#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