Emergency 20 Dokumentation  4.2.0
DLKLadderComponent.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/audio/AudioProxy.h"
14 
16 #include <qsf/job/JobProxy.h>
17 
18 #include <glm/fwd.hpp>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace qsf
25 {
26  class TransformComponent;
27  class MeshAnimationChannel;
28  class MeshAnimationComponent;
29  namespace game
30  {
31  class BoneToBoneLinkComponent;
32  }
33 }
34 
35 
36 //[-------------------------------------------------------]
37 //[ Namespace ]
38 //[-------------------------------------------------------]
39 namespace em5
40 {
41 
42 
43  //[-------------------------------------------------------]
44  //[ Classes ]
45  //[-------------------------------------------------------]
54  {
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public definitions ]
59  //[-------------------------------------------------------]
60  public:
61  static const uint32 COMPONENT_ID;
62  static const float YAW_EPSILON;
63  static const float ANIMATION_EPSILON;
64  static const glm::vec3 ARM_ORIENTATION;
65 
67  {
72  };
73 
74 
75  //[-------------------------------------------------------]
76  //[ Public methods ]
77  //[-------------------------------------------------------]
78  public:
86  explicit DlkLadderComponent(qsf::Prototype* prototype);
87 
92  virtual ~DlkLadderComponent();
93 
101  void alignLadder(const glm::vec3& position);
102 
110  void deployLadder(const glm::vec3& position);
111 
116  void foldLadder();
117 
122  bool isAnimationPlaying() const;
123 
124  // Getter and setter
125  inline float getVerticalRescueOffset() const;
126  inline void setVerticalRescueOffset(float verticalRescueOffset);
127 
128  inline float getVerticalDeployOffset() const;
129  inline void setVerticalDeployOffset(float verticalDeployOffset);
130 
131  inline float getLadderMaxRotateSpeed() const;
132  inline void setLadderMaxRotateSpeed(float ladderMaxRotateSpeed);
133 
134  inline float getLadderMinRotateSpeed() const;
135  inline void setLadderMinRotateSpeed(float ladderMinRotateSpeed);
136 
137  inline float getLadderUpSpeed() const;
138  inline void setLadderUpSpeed(float ladderUpSpeed);
139 
140  inline float getLadderExtendSpeed() const;
141  inline void setLadderExtendSpeed(float ladderExtendSpeed);
142 
143  inline float getMaxAngle() const;
144  inline void setMaxAngle(float maxAngle);
145 
146  inline float getMinLength() const;
147  inline void setMinLength(float minLength);
148 
149  inline float getMaxLength() const;
150  inline void setMaxLength(float maxLength);
151 
152  inline float getSynchronLength() const;
153  inline void setSynchronLength(float synchronLength);
154 
155  inline float getTimeUltimatum() const;
156  inline void setTimeUltimatum(float timeUltimatum);
157 
158  inline const qsf::AssetProxy& getAnimationLadderBaseUp() const;
159  inline void setAnimationLadderBaseUp(const qsf::AssetProxy& skeleton);
160 
161  inline const qsf::AssetProxy& getAnimationLadderExtend() const;
162  inline void setAnimationLadderExtend(const qsf::AssetProxy& skeleton);
163 
164  inline const AnimationState getLastAnimationState() const;
165  inline const glm::vec3& getTargetPosition() const;
166 
167  qsf::Entity* getStageEntity() const;
168 
169 
170  //[-------------------------------------------------------]
171  //[ Public virtual qsf::Component methods ]
172  //[-------------------------------------------------------]
173  public:
174  virtual void serialize(qsf::BinarySerializer& serializer) override;
175 
176 
177  //[-------------------------------------------------------]
178  //[ Private methods ]
179  //[-------------------------------------------------------]
180  private:
181  bool getComponentPointers();
182  void calculateAngleAndOffsets();
183  bool isLadderNotAligned();
184  float isAnimationSynchron(float extendOffset) const;
185  void updateAnimation(const qsf::JobArguments& jobArguments);
186 
187 
188  //[-------------------------------------------------------]
189  //[ Private data ]
190  //[-------------------------------------------------------]
191  private:
192  glm::vec3 mPostition;
193  glm::vec3 mTargetPosition;
194  qsf::Time mTimePassed;
195  AnimationState mLastAnimationState;
196 
197  // Temporary component pointers
198  qsf::TransformComponent* mLadderBaseTransformComponent;
199  qsf::game::BoneToBoneLinkComponent* mStageBoneToBoneLinkComponent;
200  qsf::MeshAnimationComponent* mLadderUpAnimation;
201  qsf::MeshAnimationComponent* mLadderExtendAnimation;
202  qsf::MeshAnimationChannel* mBaseUpAnimationChannel;
203  qsf::MeshAnimationChannel* mExtendAnimationChannel;
204  qsf::WeakPtr<qsf::Entity> mStateEntity;
205 
206  // Temporary variables
207  float mRotateYawAngle;
208  float mLadderUpAnimationOffset;
209  float mExtendAnimationOffset;
210 
211  // Job and Audio proxies
212  qsf::JobProxy mAnimationJobProxy;
213  AudioProxy mAudioProxy;
214 
215  // Exported to camp
216  float mVerticalRescueOffset;
217  float mVerticalDeployOffset;
218  float mLadderMaxRotateSpeed;
219  float mLadderMinRotateSpeed;
220  float mLadderUpSpeed;
221  float mLadderExtendSpeed;
222  float mMaxAngle;
223  float mMinLength;
224  float mMaxLength;
225  float mSynchronLength;
226  float mTimeUltimatum;
227  qsf::AssetProxy mAnimationLadderBaseUp;
228  qsf::AssetProxy mAnimationLadderExtend;
229 
230 
231  //[-------------------------------------------------------]
232  //[ CAMP reflection system ]
233  //[-------------------------------------------------------]
234  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
235 
236 
237  };
238 
239 
240 //[-------------------------------------------------------]
241 //[ Namespace ]
242 //[-------------------------------------------------------]
243 } // em5
244 
245 
246 //[-------------------------------------------------------]
247 //[ Implementation ]
248 //[-------------------------------------------------------]
250 
251 
252 //[-------------------------------------------------------]
253 //[ CAMP reflection system ]
254 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Definition: DLKLadderComponent.h:69
Job proxy class.
Definition: JobProxy.h:51
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
Transform component class.
Definition: TransformComponent.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
static const uint32 COMPONENT_ID
"em5::DlkLadderComponent" unique component ID
Definition: DLKLadderComponent.h:61
Definition: DLKLadderComponent.h:68
AnimationState
Definition: DLKLadderComponent.h:66
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
static const glm::vec3 ARM_ORIENTATION
Orientation of ladder arm.
Definition: DLKLadderComponent.h:64
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
static const float ANIMATION_EPSILON
Epsilon to check if animation offset can be assumed equal.
Definition: DLKLadderComponent.h:63
Definition: PickupPersonByParamedicAction.h:21
Asset proxy class.
Definition: AssetProxy.h:57
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
EMERGENCY 5 DLK ladder component.
Definition: DLKLadderComponent.h:53
Extended audio proxy for easier multiplay usage.
Definition: AudioProxy.h:47
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Mesh animation channel.
Definition: MeshAnimationChannel.h:48
AnimationState
Definition: IngameMainEventSuccessWindow.h:26
static const float YAW_EPSILON
Epsilon to check if yaw orientation can be assumed equal.
Definition: DLKLadderComponent.h:62
Prototype class.
Definition: Prototype.h:100
Definition: DLKLadderComponent.h:71
Binary serializer class.
Definition: BinarySerializer.h:35
Definition: DLKLadderComponent.h:70
Mesh animation component class.
Definition: MeshAnimationComponent.h:63
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32