Emergency 20 Dokumentation  4.2.0
DefectEboxEvent.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>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Public definitions ]
39  //[-------------------------------------------------------]
40  public:
41  static const uint32 FREEPLAY_EVENT_ID;
42 
43  enum EboxState
44  {
48  };
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public methods ]
53  //[-------------------------------------------------------]
54  public:
60 
65  virtual ~DefectEboxEvent();
66 
71  void setEboxEntity(qsf::Entity& entity);
72 
73  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(GapeChance, float, mGapeChance);
74  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(ReactionRadius, float, mReactionRadius);
75  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(InjuredPersonsToStartFire, uint16, mInjuredPersonsToStartFire);
76  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(FireStartTime, qsf::Time, mFireStartTime);
77  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(RepairTime, qsf::Time, mRepairTime);
78 
79 
80  //[-------------------------------------------------------]
81  //[ Public virtual em5::FreeplayEvent methods ]
82  //[-------------------------------------------------------]
83  public:
84  virtual bool onStartup() override;
85  virtual void onShutdown() override;
86  virtual void onRun() override;
87  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
88  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
89  virtual void hintCallback(Observer& hintObserver) override;
90  virtual const qsf::Entity* getFocusEntity() override;
91  virtual bool checkEventConfiguration() override;
92  virtual void serialize(qsf::BinarySerializer& serializer) override;
93 
94 
95  //[-------------------------------------------------------]
96  //[ Private methods ]
97  //[-------------------------------------------------------]
98  private:
99  void startObjectives(const qsf::Entity& targetEntity);
100  void onRepaired(const qsf::MessageParameters& parameters);
101 
102 
103  //[-------------------------------------------------------]
104  //[ Private data ]
105  //[-------------------------------------------------------]
106  private:
107  qsf::WeakPtr<qsf::Entity> mEboxEntity;
108  float mGapeChance;
109  float mReactionRadius;
110  uint16 mInjuredPersonsToStartFire;
111  qsf::Time mFireStartTime;
112  qsf::Time mRepairTime;
113 
114  // Intern
115  qsf::Time mTimeSinceStart;
116  qsf::MessageProxy mRepairMessageProxy;
117  EboxState mCurrentEboxState;
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
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
Definition: DefectEboxEvent.h:45
Definition: DefectEboxEvent.h:47
EMERGENCY 5 freeplay event "defect ebox".
Definition: DefectEboxEvent.h:33
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: DefectEboxEvent.h:46
static const uint32 FREEPLAY_EVENT_ID
"em5::DefectEboxEvent" unique freeplay event ID
Definition: DefectEboxEvent.h:41
#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
unsigned short uint16
Definition: PlatformTypes.h:178
#define QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(name, type, variable)
Definition: PropertyHelper.h:16
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
Binary serializer class.
Definition: BinarySerializer.h:35
EboxState
Definition: DefectEboxEvent.h:43
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32