Emergency 20 Dokumentation  4.2.0
TrainAccidentEvent.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 #include <qsf/base/WeakPtr.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class Layer;
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Classes ]
38  //[-------------------------------------------------------]
44  {
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public definitions ]
49  //[-------------------------------------------------------]
50  public:
51  static const uint32 FREEPLAY_EVENT_ID;
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public methods ]
56  //[-------------------------------------------------------]
57  public:
63 
68  virtual ~TrainAccidentEvent();
69 
70  void init(qsf::Layer* accidentLayer);
71 
72  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(PersonHangingTime, qsf::Time, mPersonHangingTime)
73  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(DeadPersonsToFail, int, mDeadPersonsToFail)
74  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(FailLimitBurningObjects, int, mFailLimitBurningObjects)
75 
76 
77  //[-------------------------------------------------------]
78  //[ Public virtual em5::FreeplayEvent methods ]
79  //[-------------------------------------------------------]
80  public:
81  virtual bool onStartup() override;
82  virtual void onShutdown() override;
83  virtual void onRun() override;
84  virtual bool onFailure(EventResult& eventResult) override;
85  virtual bool onSuccess(EventResult& eventResult) override;
86  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
87  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
88  virtual const qsf::Entity* getFocusEntity() override;
89  virtual bool checkEventConfiguration() override;
90  virtual void serialize(qsf::BinarySerializer& serializer) override;
91  virtual void hintCallback(Observer& hintObserver) override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Private methods ]
96  //[-------------------------------------------------------]
97  private:
98  void startObjectives();
99 
100  bool getSubLayerFromMainLayer(qsf::Layer& mainLayer);
101  void setupScene(qsf::Layer& mainLayer);
102 
103  bool checkForDLKActionInProgress();
104  void checkForSelectedTechHeli();
105  void checkForTrackPersonTweet();
106  void onHangingPersonSaved();
107  void onHangingPersonSavedPlacedFromDLK();
108  void onEboxRepaired();
109  void onBuriedFound(const qsf::MessageParameters& parameters);
110  void onDropedPersonsFromHeli(const qsf::MessageParameters& parameters);
111 
112  void showSparkleEffect(bool active);
113  void startFallingHangingPerson();
114 
115 
116  //[-------------------------------------------------------]
117  //[ Private data ]
118  //[-------------------------------------------------------]
119  private:
120  uint32 mAccidentLayerId;
121 
122  qsf::Layer* mEventLayer;
123  qsf::Layer* mEraseLayer;
124 
125  qsf::WeakPtr<qsf::Entity> mHangingPerson;
126  qsf::WeakPtr<qsf::Entity> mEBoxEntity;
127  qsf::WeakPtr<qsf::Entity> mEBoxEffect;
128  std::vector<qsf::WeakPtr<qsf::Entity>> mEBoxPersons;
129  qsf::WeakPtr<qsf::Entity> mTweetCameraEntity;
130  qsf::WeakPtr<qsf::Entity> mTweetPersonEntity;
131 
132  // Settings
133  qsf::Time mPersonHangingTime;
134  int mDeadPersonsToFail;
135  int mFailLimitBurningObjects;
136 
137  // States
138  bool mHangingPersonRescued;
139  qsf::MessageProxy mHangingPersonSaveProxy;
140  bool mEboxRepaired;
141  qsf::MessageProxy mEboxRepairedProxy;
142  qsf::MessageProxy mBuriedFoundMessageProxy;
143  qsf::MessageProxy mPersonDropedByHelicopterProxy;
144  bool mCanPlayPickupPersonTweet;
145 
146 
147  //[-------------------------------------------------------]
148  //[ CAMP reflection system ]
149  //[-------------------------------------------------------]
150  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
151 
152 
153  };
154 
155 
156 //[-------------------------------------------------------]
157 //[ Namespace ]
158 //[-------------------------------------------------------]
159 } // em5
160 
161 
162 //[-------------------------------------------------------]
163 //[ CAMP reflection system ]
164 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Layer class.
Definition: Layer.h:56
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: AreaConfiguration.h:58
Reason
Definition: EventSpreadReason.h:20
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
static const uint32 FREEPLAY_EVENT_ID
"em5::TrainAccidentEvent" unique freeplay event ID
Definition: TrainAccidentEvent.h:51
#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
#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
EMERGENCY 5 freeplay event "train accident".
Definition: TrainAccidentEvent.h:43
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32