Emergency 20 Dokumentation  4.2.0
LiftUpByCraneAction.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 
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  enum State
43  {
58  STATE_DONE
59  };
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public methods ]
64  //[-------------------------------------------------------]
65  public:
71 
76  virtual ~LiftUpByCraneAction();
77 
82  void init(qsf::Entity& targetEntity);
83 
84  uint64 getTargetId() const;
85 
86 
87  //[-------------------------------------------------------]
88  //[ Public virtual qsf::Actions methods ]
89  //[-------------------------------------------------------]
90  public:
91  virtual void serialize(qsf::BinarySerializer& serializer) override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Protected virtual qsf::Action methods ]
96  //[-------------------------------------------------------]
97  protected:
98  virtual bool onStartup() override;
99  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
100  virtual void onShutdown() override;
101 
102 
103  //[-------------------------------------------------------]
104  //[ Private methods ]
105  //[-------------------------------------------------------]
106  private:
107  void unhideBuriedEntities(qsf::Entity& targetEntity);
108  void finishTargetEntity(qsf::Entity& targetEntity);
109  void deleteBuoy(qsf::Entity& targetEntity);
110  bool findDisposePosition(qsf::Entity& targetEntity, uint32 numberOfChecks);
111  void linkParticles(qsf::Entity& targetEntity, qsf::Entity* particleEntity, float delay, float timeout);
112  void unlinkParticles(qsf::Entity& targetEntity);
113  bool canReachNextTargetFromSamePosition();
114 
115 
116  //[-------------------------------------------------------]
117  //[ Private data ]
118  //[-------------------------------------------------------]
119  private:
120  // Configuration
121  uint64 mTargetEntityId;
122  State mState;
123  glm::vec3 mTargetPosition;
124  glm::vec3 mDisposePosition;
125  float mObjectHeight;
126  float mCraneHeight;
127  bool mInWater;
128  bool mTargetPlaced;
129 
130  // Only for temporary entities, no weak pointer necessary
131  qsf::Entity* mWatersprayEntity;
132  qsf::Entity* mWaterdropsEntity;
133 
134 
135  //[-------------------------------------------------------]
136  //[ CAMP reflection system ]
137  //[-------------------------------------------------------]
138  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
139 
140 
141  };
142 
143 
144 //[-------------------------------------------------------]
145 //[ Namespace ]
146 //[-------------------------------------------------------]
147 } // em5
148 
149 
150 //[-------------------------------------------------------]
151 //[ CAMP reflection system ]
152 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
State
Definition: LiftUpByCraneAction.h:42
Definition: LiftUpByCraneAction.h:51
unsigned int uint32
Definition: PlatformTypes.h:181
Definition: LiftUpByCraneAction.h:47
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: LiftUpByCraneAction.h:45
EMERGENCY 5 lift up objects by heavy crane action.
Definition: LiftUpByCraneAction.h:32
uint64_t uint64
Definition: PlatformTypes.h:184
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
State
Definition: ProcessState.h:20
#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: LiftUpByCraneAction.h:44
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Definition: LiftUpByCraneAction.h:56
Definition: LiftUpByCraneAction.h:57
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
Definition: LiftUpByCraneAction.h:55
static const qsf::NamedIdentifier ACTION_ID
"em5::LiftUpByCraneAction" unique action identifier
Definition: LiftUpByCraneAction.h:40
Definition: LiftUpByCraneAction.h:46