Emergency 20 Dokumentation  4.2.0
RowdyEvent.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 
16 //[-------------------------------------------------------]
17 //[ Namespace ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21 
22 
23  //[-------------------------------------------------------]
24  //[ Classes ]
25  //[-------------------------------------------------------]
31  {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Public definitions ]
36  //[-------------------------------------------------------]
37  public:
38  static const uint32 FREEPLAY_EVENT_ID;
39 
40 
41  //[-------------------------------------------------------]
42  //[ Public methods ]
43  //[-------------------------------------------------------]
44  public:
49  RowdyEvent();
50 
55  virtual ~RowdyEvent();
56 
61  uint64 getGangsterId() const;
62 
67  void setGangster(const qsf::Entity& entity);
68 
73  uint64 getBuildingId() const;
74 
79  void setBuilding(const qsf::Entity& entity);
80 
81  void setPeopleToAttack(uint64 peopleToAttack);
82 
83 
84  //[-------------------------------------------------------]
85  //[ Public virtual em5::FreeplayEvent methods ]
86  //[-------------------------------------------------------]
87  public:
88  virtual bool onStartup() override;
89  virtual void onShutdown() override;
90  virtual void onRun() override;
91  virtual bool onFailure(EventResult& eventResult) override;
92  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
93  virtual void hintCallback(Observer& hintObserver) override;
94  virtual const qsf::Entity* getFocusEntity() override;
95  virtual bool checkEventConfiguration() override;
96  virtual void serialize(qsf::BinarySerializer& serializer) override;
97 
98 
99  //[-------------------------------------------------------]
100  //[ Private methods ]
101  //[-------------------------------------------------------]
102  private:
103  void startObjectives(qsf::Entity& targetEntity);
104  void startHintObservers();
105  bool checkIfIsHealthy(const qsf::Entity& victim) const;
106  bool checkIfReachedVictim(qsf::Entity& gangster, qsf::Entity& victim) const;
107  qsf::Entity* findNewTarget(qsf::Entity& gangster) const;
108  qsf::Entity* findNewPoliceTarget(qsf::Entity& gangster) const;
109  void attackTarget(qsf::Entity& gangster, qsf::Entity& victim);
110  bool checkVictim(qsf::Entity& gangster, qsf::Entity& victim) const;
111 
112 
113  //[-------------------------------------------------------]
114  //[ Private data ]
115  //[-------------------------------------------------------]
116  private:
117  uint64 mBuildingId;
118  uint64 mGangsterId;
119  uint64 mCurrentVictimId;
120  uint64 mAttacksLeft;
121  bool mWaiting;
122  bool mRowdyHurt;
123  bool mVisible;
124  bool mDontShootTriggered;
125 
126 
127  //[-------------------------------------------------------]
128  //[ CAMP reflection system ]
129  //[-------------------------------------------------------]
130  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
131 
132 
133  };
134 
135 
136 //[-------------------------------------------------------]
137 //[ Namespace ]
138 //[-------------------------------------------------------]
139 } // em5
140 
141 
142 //[-------------------------------------------------------]
143 //[ CAMP reflection system ]
144 //[-------------------------------------------------------]
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
uint64_t uint64
Definition: PlatformTypes.h:184
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 "Rowdy".
Definition: RowdyEvent.h:30
EMERGENCY 5 gangster freeplay event base class.
Definition: GangsterEvent.h:41
static const uint32 FREEPLAY_EVENT_ID
"em5::RowdyEvent" unique freeplay event ID
Definition: RowdyEvent.h:38
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