Emergency 20 Dokumentation  4.2.0
ArsonistEvent.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 //[ Forward declarations ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21  class BuildingComponent;
22 }
23 
24 
25 //[-------------------------------------------------------]
26 //[ Namespace ]
27 //[-------------------------------------------------------]
28 namespace em5
29 {
30 
31 
32  //[-------------------------------------------------------]
33  //[ Classes ]
34  //[-------------------------------------------------------]
40  {
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public definitions ]
45  //[-------------------------------------------------------]
46  public:
47  static const uint32 FREEPLAY_EVENT_ID;
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public methods ]
52  //[-------------------------------------------------------]
53  public:
58  ArsonistEvent();
59 
64  virtual ~ArsonistEvent();
65 
70  uint64 getGangsterId() const;
71 
76  void setArsonist(const qsf::Entity& entity);
77 
82  void setFirstBuildingMustHaveBalcony(bool firstBuildingMustHaveBalcony);
83 
84  void setCheeringTime(const qsf::Time& cheeringTime);
85 
86 
87  //[-------------------------------------------------------]
88  //[ Public virtual em5::FreeplayEvent methods ]
89  //[-------------------------------------------------------]
90  public:
91  virtual bool onStartup() override;
92  virtual void onShutdown() override;
93  virtual void onRun() override;
94  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
95  virtual void hintCallback(Observer& hintObserver);
96  virtual const qsf::Entity* getFocusEntity() override;
97  virtual bool checkEventConfiguration() override;
98  virtual void serialize(qsf::BinarySerializer& serializer) override;
99  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
100 
101 
102  //[-------------------------------------------------------]
103  //[ Private methods ]
104  //[-------------------------------------------------------]
105  private:
106  BuildingComponent* findBuildingCandidate(qsf::Entity& arsonist) const;
107  bool checkBuildingCandidate(qsf::Entity& building) const;
108  void startObjectives(const qsf::Entity& targetEntity);
109  void startHintObservers();
110  bool checkIfIsHealthy(const qsf::Entity& victim) const;
111  void escape(qsf::Entity& gangster) const;
112 
113 
114  //[-------------------------------------------------------]
115  //[ Private data ]
116  //[-------------------------------------------------------]
117  private:
118  uint64 mGangsterId;
119  uint64 mCurrentTargetId;
120  uint64 mBuildingsBurnt;
121  bool mFirstBuildingMustHaveBalcony;
122  bool mPerpetrated;
123  bool mRescue;
124  qsf::Time mCheeringTime;
125  bool mDontShootTriggered;
126 
127  enum NextAction
128  {
129  UNDEFINED = 0,
130  GO_TO_NEXT_BUILDING,
131  SET_BUILDING_ON_FIRE,
132  WATCH_AND_CHEER,
133  DO_NOTHING
134  } mNextAction;
135 
136 
137  //[-------------------------------------------------------]
138  //[ CAMP reflection system ]
139  //[-------------------------------------------------------]
140  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
141 
142 
143  };
144 
145 
146 //[-------------------------------------------------------]
147 //[ Namespace ]
148 //[-------------------------------------------------------]
149 } // em5
150 
151 
152 //[-------------------------------------------------------]
153 //[ CAMP reflection system ]
154 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
EMERGENCY 5 building component class.
Definition: BuildingComponent.h:56
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
static const uint32 FREEPLAY_EVENT_ID
"em5::ArsonistEvent" unique freeplay event ID
Definition: ArsonistEvent.h:47
Reason
Definition: EventSpreadReason.h:20
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
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 freeplay event class for "Arsonist".
Definition: ArsonistEvent.h:39
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32