Emergency 20 Dokumentation  4.2.0
EnterVehicleAction.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 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public definitions ]
38  //[-------------------------------------------------------]
39  public:
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public static methods ]
45  //[-------------------------------------------------------]
46  public:
47  static bool isInDoorRange(qsf::Entity& callerEntity, qsf::Entity& targetEntity, DoorComponent::DoorType doorType, float maxDistance);
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public methods ]
52  //[-------------------------------------------------------]
53  public:
59 
64  virtual ~EnterVehicleAction();
65 
70  void init(const qsf::Entity& targetEntity, DoorComponent::DoorType doorType = DoorComponent::DOORTYPE_UNDEFINED);
71 
72  uint64 getTargetId() const;
73  DoorComponent::DoorType getTargetDoorType() const;
74 
75 
76  //[-------------------------------------------------------]
77  //[ Public virtual qsf::Actions methods ]
78  //[-------------------------------------------------------]
79  public:
80  virtual void serialize(qsf::BinarySerializer& serializer) override;
81 
82 
83  //[-------------------------------------------------------]
84  //[ Protected virtual qsf::Action methods ]
85  //[-------------------------------------------------------]
86  protected:
87  virtual bool onStartup() override;
88  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
89 
90 
91  //[-------------------------------------------------------]
92  //[ Private methods ]
93  //[-------------------------------------------------------]
94  private:
95  bool checkActionCondition();
96  bool checkForNextUserInArea(qsf::Entity& targetEntity) const;
97 
98 
99  //[-------------------------------------------------------]
100  //[ Private definitions ]
101  //[-------------------------------------------------------]
102  private:
103  enum State
104  {
105  STATE_INIT,
106  STATE_OPEN_DOOR,
107  STATE_ENTER,
108  STATE_IS_ENTERED,
109  STATE_CLOSE_DOOR
110  };
111 
112 
113  //[-------------------------------------------------------]
114  //[ Private data ]
115  //[-------------------------------------------------------]
116  private:
117  // Configuration
118  uint64 mTargetEntityId;
119  DoorComponent::DoorType mDoorType;
120 
121  // Internal
122  State mCurrentState;
123  qsf::Time mWaitTime;
124  qsf::WeakPtr<qsf::MeshAnimationChannel> mMeshAnimationChannel;
125 
126 
127  //[-------------------------------------------------------]
128  //[ CAMP reflection system ]
129  //[-------------------------------------------------------]
130  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
131 
132 
133  };
134 
135 
136 //[-------------------------------------------------------]
137 //[ Namespace ]
138 //[-------------------------------------------------------]
139 } // em5
140 
141 
142 //[-------------------------------------------------------]
143 //[ CAMP reflection system ]
144 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
EMERGENCY 5 enter vehicle action.
Definition: EnterVehicleAction.h:32
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
uint64_t uint64
Definition: PlatformTypes.h:184
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
static const qsf::NamedIdentifier ACTION_ID
"em5::EnterVehicleAction" unique action identifier
Definition: EnterVehicleAction.h:40
State
Definition: ProcessState.h:20
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
DoorType
Definition: DoorComponent.h:63
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Undefined door type.
Definition: DoorComponent.h:65
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32