Emergency 20 Dokumentation  4.2.0
GangsterME301Arsonist.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 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public definitions ]
38  //[-------------------------------------------------------]
39  public:
40  static const uint32 GAMELOGIC_TYPE_ID; // "em5::GangsterME301Arsonist" game logic type ID
41 
42  static const uint32 MESSAGE_FIRE_STARTED; // Message emitted when gangster started a fire again
43 
44 
45  //[-------------------------------------------------------]
46  //[ Public methods ]
47  //[-------------------------------------------------------]
48  public:
50 
51  void setTimeToStartFire(qsf::Time time);
52  void setFirefighterBuildingEvacuateTime(qsf::Time time);
53  void setMaxBurningObjectsToStartFire(uint32 value);
54  void initializeWithTargets(const std::vector<qsf::Entity*>& targetBuildings);
55 
56  void startFireAtRandomTarget();
57  void placeAtNextTarget();
58 
59 
60  //[-------------------------------------------------------]
61  //[ Public virtual qsf::GameLogic methods ]
62  //[-------------------------------------------------------]
63  public:
64  virtual bool onStartup() override;
65 
66 
67  //[-------------------------------------------------------]
68  //[ Protected virtual em5::GangsterBaseLogic methods ]
69  //[-------------------------------------------------------]
70  protected:
71  virtual void onSimulationUpdate(const qsf::JobArguments& jobArguments) override;
72  virtual void onIdle() override;
73  virtual void onWaypointReached(const Waypoint& waypoint) override;
74 
75 
76  //[-------------------------------------------------------]
77  //[ Private definitions ]
78  //[-------------------------------------------------------]
79  private:
80  struct BuildingInfo
81  {
83  glm::vec3 mPosition;
84  bool mVisited = false;
85  };
86 
87 
88  //[-------------------------------------------------------]
89  //[ Private methods ]
90  //[-------------------------------------------------------]
91  private:
92  void onStartFireMessage(const qsf::MessageParameters& parameters);
93 
94  bool chooseNextTarget();
95  void startFireInBuilding(BuildingInfo& building, bool fullFire);
96 
97 
98  //[-------------------------------------------------------]
99  //[ Private data ]
100  //[-------------------------------------------------------]
101  private:
102  qsf::Time mTimeToStartFire;
103  qsf::Time mFirefighterBuildingEvacuateTime;
104  uint32 mMaxBurningObjectsToStartFire;
105 
106  std::vector<BuildingInfo> mBuildingsGroup01;
107  std::vector<BuildingInfo> mBuildingsGroup02;
108 
109  glm::vec3 mFinalPosition;
110  size_t mNextTargetIndex;
111  bool mAllDone;
112 
113  qsf::MessageProxy mStartFireMessageProxy;
114 
115 
116  //[-------------------------------------------------------]
117  //[ CAMP reflection system ]
118  //[-------------------------------------------------------]
119  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
120 
121 
122  };
123 
124 
125 //[-------------------------------------------------------]
126 //[ Namespace ]
127 //[-------------------------------------------------------]
128 } // em5
129 
130 
131 //[-------------------------------------------------------]
132 //[ CAMP reflection system ]
133 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Game logic for gangster type used in "Arsonist" Emergency 20 years event.
Definition: GangsterME301Arsonist.h:32
Message listener proxy class.
Definition: MessageProxy.h:47
static const uint32 GAMELOGIC_TYPE_ID
Definition: GangsterME301Arsonist.h:40
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
static const uint32 MESSAGE_FIRE_STARTED
Definition: GangsterME301Arsonist.h:42
#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
Base game logic for gangster.
Definition: GangsterBaseLogic.h:52
Definition: GangsterBaseLogic.h:331
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32