Emergency 20 Dokumentation  4.2.0
ThrowWeaponAction.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"
15 
17 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
37  {
38 
39 
40  //[-------------------------------------------------------]
41  //[ Public definitions ]
42  //[-------------------------------------------------------]
43  public:
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public methods ]
49  //[-------------------------------------------------------]
50  public:
56 
61  virtual ~ThrowWeaponAction();
62 
67  void init(const qsf::Entity& targetEntity, weapon::Weapon thrownWeapon);
68 
69 
70  //[-------------------------------------------------------]
71  //[ Public virtual qsf::Actions methods ]
72  //[-------------------------------------------------------]
73  public:
74  virtual void serialize(qsf::BinarySerializer& serializer) override;
75 
76 
77  //[-------------------------------------------------------]
78  //[ Protected virtual qsf::Action methods ]
79  //[-------------------------------------------------------]
80  protected:
81  virtual bool onStartup() override;
82  virtual void onShutdown() override;
83  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
84 
85 
86  //[-------------------------------------------------------]
87  //[ Private definitions ]
88  //[-------------------------------------------------------]
89  private:
90  enum State
91  {
92  STATE_INIT,
93  STATE_THROW,
94  STATE_FLYING,
95  STATE_FLYING2,
96  STATE_DONE
97  };
98 
99 
100  //[-------------------------------------------------------]
101  //[ Private methods ]
102  //[-------------------------------------------------------]
103  private:
104  qsf::Entity* getEquipmentFromPrefabAndSetAsActive(qsf::Entity& parent, const std::string& prefab);
105 
106 
107  //[-------------------------------------------------------]
108  //[ Private data ]
109  //[-------------------------------------------------------]
110  private:
111  // Configuration
112  uint64 mTargetEntityId;
113  weapon::Weapon mThrownWeapon;
114  State mCurrentState;
115  uint64 mThrowableId;
116 
117  qsf::WeakPtr<qsf::Entity> mThrowableEntity;
118 
119 
120  //[-------------------------------------------------------]
121  //[ CAMP reflection system ]
122  //[-------------------------------------------------------]
123  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
124 
125 
126  };
127 
128 
129 //[-------------------------------------------------------]
130 //[ Namespace ]
131 //[-------------------------------------------------------]
132 } // em5
133 
134 
135 //[-------------------------------------------------------]
136 //[ CAMP reflection system ]
137 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
static const qsf::NamedIdentifier ACTION_ID
"em5::ThrowWeaponAction" unique action identifier
Definition: ThrowWeaponAction.h:44
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
State
Definition: ProcessState.h:20
EMERGENCY 5 throw weapon action.
Definition: ThrowWeaponAction.h:36
#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
Weapon
Definition: Weapon.h:22
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