Emergency 20 Dokumentation  4.2.0
EscapeFootLongAction.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 
15 
16 //[-------------------------------------------------------]
17 //[ Forward declarations ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21  class PersonSpawnPointComponent;
22 }
23 
24 
25 //[-------------------------------------------------------]
26 //[ Namespace ]
27 //[-------------------------------------------------------]
28 namespace em5
29 {
30 
31 
32  //[-------------------------------------------------------]
33  //[ Classes ]
34  //[-------------------------------------------------------]
40  {
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public definitions ]
45  //[-------------------------------------------------------]
46  public:
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public methods ]
52  //[-------------------------------------------------------]
53  public:
59 
64  virtual ~EscapeFootLongAction();
65 
70  void init(bool movementModeRun = true);
71  void init(const qsf::Time& escapeLength, bool movementModeRun = true);
72  void init(const std::string& escapeTargetTag, bool movementModeRun = true);
73 
78  virtual void catched() override;
79 
80 
81  //[-------------------------------------------------------]
82  //[ Public virtual qsf::Action methods ]
83  //[-------------------------------------------------------]
84  public:
85  virtual void serialize(qsf::BinarySerializer& serializer) override;
86  virtual void onShutdown() override;
87 
88 
89  //[-------------------------------------------------------]
90  //[ Protected virtual qsf::Action methods ]
91  //[-------------------------------------------------------]
92  protected:
93  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private methods ]
98  //[-------------------------------------------------------]
99  private:
100  void runTowardsClosestEscapePoint();
101  void runTowardsDistantPosition();
102  void runTowardsPosition(const glm::vec3& position);
103 
104  bool collectDespawnPoints(std::vector<PersonSpawnPointComponent*>& outPoints, bool onlyOutsideMapBoundaries);
105 
106 
107  //[-------------------------------------------------------]
108  //[ Private data ]
109  //[-------------------------------------------------------]
110  private:
111  qsf::Time mTimeRunning;
112  qsf::Time mTimeUntilNextPause;
113  qsf::Time mMaximumTime;
114  glm::vec3 mCurrentTargetPosition;
115  bool mMovementModeRun;
116 
117  enum class EscapeMode
118  {
119  FIXED,
120  LONG,
121  SHORT
122  };
123  EscapeMode mEscapeMode;
124 
125 
126  //[-------------------------------------------------------]
127  //[ CAMP reflection system ]
128  //[-------------------------------------------------------]
129  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
130 
131 
132  };
133 
134 
135 //[-------------------------------------------------------]
136 //[ Namespace ]
137 //[-------------------------------------------------------]
138 } // em5
139 
140 
141 //[-------------------------------------------------------]
142 //[ CAMP reflection system ]
143 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
static const qsf::NamedIdentifier ACTION_ID
"em5::EscapeFootLongAction" unique action identifier
Definition: EscapeFootLongAction.h:47
EMERGENCY 5 base escape action.
Definition: EscapeAction.h:41
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
EMERGENCY 5 escape foot long action.
Definition: EscapeFootLongAction.h:39
#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
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