Emergency 20 Dokumentation  4.2.0
PathMovementComponent.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 
17 #include <qsf/job/JobProxy.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace qsf
25 {
26  class PathComponent;
27  class TransformComponent;
28 }
29 
30 
31 //[-------------------------------------------------------]
32 //[ Namespace ]
33 //[-------------------------------------------------------]
34 namespace em5
35 {
36 
37 
38  //[-------------------------------------------------------]
39  //[ Classes ]
40  //[-------------------------------------------------------]
49  {
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public definitions ]
54  //[-------------------------------------------------------]
55  public:
56  static const uint32 COMPONENT_ID;
57 
58 
59  //[-------------------------------------------------------]
60  //[ Public methods ]
61  //[-------------------------------------------------------]
62  public:
70  explicit PathMovementComponent(qsf::Prototype* prototype);
71 
76  virtual ~PathMovementComponent();
77 
78  void setPath(qsf::PathComponent& pathComponent, bool activate = true);
79  void setPath(const qsf::Entity& entityContainingPath, bool activate = true);
80 
81  void setSpeed(float speed);
82  void setSpeedByTime(const qsf::Time& time);
83 
84  void initializeConfiguration(float speed, float maximumAcceleration, float maximumDeceleration, float mCurveSpeedReduction);
85 
86  bool isLooped() const;
87  void setLooped(bool looped);
88 
93  float getPathProgressPercentage() const;
94 
95  // Getters and setters for single entity slots
96  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(PathToFollowId, uint64, mPathEntityId);
97 
98 
99  //[-------------------------------------------------------]
100  //[ Protected virtual qsf::Component methods ]
101  //[-------------------------------------------------------]
102  protected:
103  virtual void onSetSimulating(bool simulating) override;
104  virtual void onSetActive(bool active) override;
105 
106 
107  //[-------------------------------------------------------]
108  //[ Private methods ]
109  //[-------------------------------------------------------]
110  private:
111  void updateJob(const qsf::JobArguments& jobArguments);
112  void internalActivate(bool activate);
113 
114 
115  //[-------------------------------------------------------]
116  //[ Private data ]
117  //[-------------------------------------------------------]
118  private:
119  qsf::JobProxy mUpdateJobProxy;
120  qsf::PathSegmenter mPathSegmenter;
122 
123  // Configuration
124  float mMaximumSpeed;
125  float mMaximumAcceleration;
126  float mMaximumDeceleration;
127  float mCurveSpeedReduction;
128  bool mLooped;
129 
130  float mCurrentSpeed;
131  float mCurrentPathOffset;
132  uint64 mPathEntityId;
133  bool mAiNavigationWasActiveBefore;
134 
135 
136  //[-------------------------------------------------------]
137  //[ CAMP reflection system ]
138  //[-------------------------------------------------------]
139  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
140 
141 
142  };
143 
144 
145 //[-------------------------------------------------------]
146 //[ Namespace ]
147 //[-------------------------------------------------------]
148 } // em5
149 
150 
151 //[-------------------------------------------------------]
152 //[ CAMP reflection system ]
153 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
EMERGENCY 5 move entity along a given path component.
Definition: PathMovementComponent.h:48
Abstract component class.
Definition: Component.h:105
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
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Path component class.
Definition: PathComponent.h:30
Path segmenter helper class.
Definition: PathSegmenter.h:48
Definition: PickupPersonByParamedicAction.h:21
#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
Prototype class.
Definition: Prototype.h:100
static const uint32 COMPONENT_ID
"em5::PathMovementComponent" unique component ID
Definition: PathMovementComponent.h:56
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32