Emergency 20 Dokumentation  4.2.0
HelicopterHatchComponent.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 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
16 #include <qsf/job/JobProxy.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 COMPONENT_ID;
42 
44  {
52  CLOSEING_HATCH
53  };
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public methods ]
58  //[-------------------------------------------------------]
59  public:
67  explicit HelicopterHatchComponent(qsf::Prototype* prototype);
68 
73  virtual ~HelicopterHatchComponent();
74 
82  void openHatch(qsf::Entity& targetEntity, bool targetIsInjured);
83 
91  void startLowerStretcherWithInjured(const glm::vec3& targetPosition);
92 
103  void raiseStretcher(bool isTargetInjured);
104 
105  bool isLowerStretcher() const;
106  bool isRaiseStretcher() const;
107 
112  bool isTransportingInjuredPerson() const;
113 
114  qsf::Entity* getStretcherEntity() const;
115  qsf::Entity* getTargetFromStretcher();
116 
117  float getLowerStretcherSpeed() const;
118  void setLowerStretcherSpeed(float meterPerSecond);
119 
120  float getRaiseStretcherSpeed() const;
121  void setRaiseStretcherSpeed(float meterPerSecond);
122 
123  float getInjuredPersonFlyHigh() const;
124  void setInjuredPersonFlyHigh(float injuredPersonFlyHigh);
125 
126  // Link target and play animation
127  void placeTargetOnStretcher();
128 
129  // Unlink target and place it on the ground
130  void placeTargetOnGround(qsf::Entity& targetEntity);
131 
132 
133  //[-------------------------------------------------------]
134  //[ Public virtual qsf::Component methods ]
135  //[-------------------------------------------------------]
136  public:
137  virtual void serialize(qsf::BinarySerializer& serializer) override;
138 
139 
140  //[-------------------------------------------------------]
141  //[ Private methods ]
142  //[-------------------------------------------------------]
143  private:
144  void activateJob();
145  void deactivateJob();
146  void updateJob(const qsf::JobArguments& jobArguments);
147 
148  void createStretcher();
149  bool updateLowerStretcher(float secondsPassed);
150  bool updateHigherStretcher(float secondsPassed);
151  void closeHatch();
152  void destroyStretcher();
153 
154 
155  //[-------------------------------------------------------]
156  //[ Private data ]
157  //[-------------------------------------------------------]
158  private:
159  HelicopterHatchState mHelicopterHatchState;
160  qsf::WeakPtr<qsf::Entity> mStretcherEntity;
161  qsf::WeakPtr<qsf::Entity> mTargetEntity;
162  bool mTargetIsInjured;
163  glm::vec3 mTargetPosition;
164 
165  float mLowerHatchSpeed;
166  float mRaiseHatchSpeed;
167  float mInjuredPersonFlyHigh;
168 
169  // Internal
170  qsf::JobProxy mUpdateJobProxy;
171 
172 
173  //[-------------------------------------------------------]
174  //[ CAMP reflection system ]
175  //[-------------------------------------------------------]
176  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
177 
178 
179  };
180 
181 
182 //[-------------------------------------------------------]
183 //[ Namespace ]
184 //[-------------------------------------------------------]
185 } // em5
186 
187 
188 //[-------------------------------------------------------]
189 //[ CAMP reflection system ]
190 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
static const uint32 COMPONENT_ID
"em5::HelicopterHatchComponent" unique component ID
Definition: HelicopterHatchComponent.h:41
unsigned int uint32
Definition: PlatformTypes.h:181
EMERGENCY 5 helicopter hatch component.
Definition: HelicopterHatchComponent.h:33
Definition: HelicopterHatchComponent.h:49
Definition: HelicopterHatchComponent.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: HelicopterHatchComponent.h:46
#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
Definition: HelicopterHatchComponent.h:47
Prototype class.
Definition: Prototype.h:100
Definition: HelicopterHatchComponent.h:45
HelicopterHatchState
Definition: HelicopterHatchComponent.h:43
Binary serializer class.
Definition: BinarySerializer.h:35
Definition: HelicopterHatchComponent.h:48
Definition: HelicopterHatchComponent.h:50