Emergency 20 Dokumentation  4.2.0
GrandTheftAutoEvent.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>
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 FREEPLAY_EVENT_ID;
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public methods ]
45  //[-------------------------------------------------------]
46  public:
52 
57  virtual ~GrandTheftAutoEvent();
58 
63  uint64 getCarId() const;
64 
69  void setCar(qsf::Entity& entity);
70 
71 
72  //[-------------------------------------------------------]
73  //[ Public virtual em5::FreeplayEvent methods ]
74  //[-------------------------------------------------------]
75  public:
76  virtual bool onStartup() override;
77  virtual void onShutdown() override;
78  virtual void onRun() override;
79  virtual bool onFailure(EventResult& eventResult) override;
80  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
81  virtual void hintCallback(Observer& hintObserver) override;
82  virtual const qsf::Entity* getFocusEntity() override;
83  virtual bool checkEventConfiguration() override;
84  virtual void serialize(qsf::BinarySerializer& serializer) override;
85 
86 
87  //[-------------------------------------------------------]
88  //[ Private methods ]
89  //[-------------------------------------------------------]
90  private:
91  void startHintObservers();
92  bool checkIfReachedTarget(qsf::Entity& gangster);
93  qsf::Entity* findCar(qsf::Entity& gangster, qsf::Entity& trafficLight);
94  void setupGangster(qsf::Entity& gangster, qsf::Entity& victim);
95  void escape(qsf::Entity& gangster);
96 
97 
98  //[-------------------------------------------------------]
99  //[ Private definitions ]
100  //[-------------------------------------------------------]
101  private:
102  enum EventState
103  {
104  PERPETRATING,
105  ESCAPING,
106  RESCUE
107  };
108 
109 
110  //[-------------------------------------------------------]
111  //[ Private data ]
112  //[-------------------------------------------------------]
113  private:
114  qsf::WeakPtr<qsf::Entity> mGangster;
116  uint64 mVictimId;
117  EventState mState;
118 
119 
120  //[-------------------------------------------------------]
121  //[ CAMP reflection system ]
122  //[-------------------------------------------------------]
123  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
124 
125 
126  };
127 
128 
129 //[-------------------------------------------------------]
130 //[ Namespace ]
131 //[-------------------------------------------------------]
132 } // em5
133 
134 
135 //[-------------------------------------------------------]
136 //[ CAMP reflection system ]
137 //[-------------------------------------------------------]
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
static const uint32 FREEPLAY_EVENT_ID
"em5::GrandTheftAutoEvent" unique freeplay event ID
Definition: GrandTheftAutoEvent.h:40
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 "GrandTheftAuto".
Definition: GrandTheftAutoEvent.h:32
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
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