Emergency 20 Dokumentation  4.2.0
GangsterFanaticArsonistLogic.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::GangsterFanaticArsonistLogic" game logic type ID
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public methods ]
45  //[-------------------------------------------------------]
46  public:
48 
49  inline void setIgniteTimeStake(const qsf::Time& time) { mIgniteTimeStake = time; }
50  inline void setIgniteTimeObject(const qsf::Time& time) { mIgniteTimeObject = time; }
51  inline void setCheeringTime(const qsf::Time& time) { mCheeringTime = time; }
52 
53  void setArsonistTargets(std::vector<std::string>& targetEventTags);
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public virtual qsf::GameLogic methods ]
58  //[-------------------------------------------------------]
59  public:
60  virtual bool onStartup() override;
61  virtual void onShutdown() override;
62 
63 
64  //[-------------------------------------------------------]
65  //[ Protected virtual em5::GangsterBaseLogic methods ]
66  //[-------------------------------------------------------]
67  protected:
68  virtual void onSimulationUpdate(const qsf::JobArguments& jobArguments) override;
69 
70  // Note: Don't simply save the list because there is no possibility to make sure that the entity references stay valid after the method returns
71  virtual void onUnitsSpotted(std::vector<SpottedUnit>& sightedPoliceUnits) override;
72 
73  // Notifies us when no more police units are within range
74  virtual void onNoUnitsSpotted() override;
75 
76 
77  //[-------------------------------------------------------]
78  //[ Private methods ]
79  //[-------------------------------------------------------]
80  private:
81  qsf::Entity* getNextTarget();
82  void onTargetWasIgnited(const qsf::MessageParameters& parameters);
83  bool isTargetInvalid() const;
84 
85 
86  //[-------------------------------------------------------]
87  //[ Private definitions ]
88  //[-------------------------------------------------------]
89  private:
90  enum State
91  {
92  STATE_UNDEFINED = 0,
93  STATE_ANGRY_PROTEST,
94  STATE_ANGRY_PROTEST_END,
95  STATE_GO_TO_NEXT_TARGET,
96  STATE_SET_TARGET_ON_FIRE,
97  STATE_SET_TARGET_ON_FIRE_END,
98  STATE_WATCH_AND_CHEER,
99  STATE_WATCH_AND_CHEER_END,
100  STATE_DO_NOTHING
101  };
102 
103 
104  //[-------------------------------------------------------]
105  //[ Private data ]
106  //[-------------------------------------------------------]
107  private:
108  uint64 mCurrentTargetId;
109  qsf::Time mIgniteTimeStake;
110  qsf::Time mIgniteTimeObject;
111  qsf::Time mCheeringTime;
112  State mCurrentState;
113  std::vector<std::string> mTargetEventTags;
114  int mCurrentTargetIndex;
115  qsf::Transform mStartingTransform;
116  qsf::MessageProxy mIgniteTargetMessageProxy;
117 
118 
119  //[-------------------------------------------------------]
120  //[ CAMP reflection system ]
121  //[-------------------------------------------------------]
122  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
123 
124 
125  };
126 
127 
128 //[-------------------------------------------------------]
129 //[ Namespace ]
130 //[-------------------------------------------------------]
131 } // em5
132 
133 
134 //[-------------------------------------------------------]
135 //[ CAMP reflection system ]
136 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
void setIgniteTimeObject(const qsf::Time &time)
Definition: GangsterFanaticArsonistLogic.h:50
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
uint64_t uint64
Definition: PlatformTypes.h:184
static const uint32 GAMELOGIC_TYPE_ID
Definition: GangsterFanaticArsonistLogic.h:40
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
3D transform class
Definition: Transform.h:45
State
Definition: ProcessState.h:20
#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
void setIgniteTimeStake(const qsf::Time &time)
Definition: GangsterFanaticArsonistLogic.h:49
Base game logic for gangster.
Definition: GangsterBaseLogic.h:52
void setCheeringTime(const qsf::Time &time)
Definition: GangsterFanaticArsonistLogic.h:51
Game logic for gangster type "ME200Fanatic".
Definition: GangsterFanaticArsonistLogic.h:32
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32