Emergency 20 Dokumentation  4.2.0
BeThrownWeaponAction.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  //[-------------------------------------------------------]
38  {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Public definitions ]
43  //[-------------------------------------------------------]
44  public:
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public methods ]
50  //[-------------------------------------------------------]
51  public:
57 
62  virtual ~BeThrownWeaponAction();
63 
68  void init(uint64 throwerEntityId, uint64 targetEntityId, weapon::Weapon thrownWeapon, bool throwToGround = false);
69 
70 
71  //[-------------------------------------------------------]
72  //[ Public virtual qsf::Actions methods ]
73  //[-------------------------------------------------------]
74  public:
75  virtual void serialize(qsf::BinarySerializer& serializer) override;
76 
77 
78  //[-------------------------------------------------------]
79  //[ Protected virtual qsf::Action methods ]
80  //[-------------------------------------------------------]
81  protected:
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_FLYING
94  };
95 
96 
97  //[-------------------------------------------------------]
98  //[ Private methods ]
99  //[-------------------------------------------------------]
100  private:
101  void onCollision(qsf::Entity* hitTarget);
102 
103 
104  //[-------------------------------------------------------]
105  //[ Private data ]
106  //[-------------------------------------------------------]
107  private:
108  float mAccumulatedTime;
109  uint64 mThrowerEntityId;
110  uint64 mTargetEntityId;
111  glm::vec3 mInitialPosition;
112  glm::vec3 mTargetPosition;
113  State mCurrentState;
114  weapon::Weapon mThrownWeapon;
115  bool mThrowToGround;
116  bool mCanPlayAudio;
117 
118 
119  //[-------------------------------------------------------]
120  //[ CAMP reflection system ]
121  //[-------------------------------------------------------]
122  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
123 
124 
125  };
126 
127 
128 //[-------------------------------------------------------]
129 //[ Namespace ]
130 //[-------------------------------------------------------]
131 } // em5
132 
133 
134 //[-------------------------------------------------------]
135 //[ CAMP reflection system ]
136 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
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::BeThrownWeaponAction" unique action identifier
Definition: BeThrownWeaponAction.h:45
EMERGENCY 5 be thrown weapon action.
Definition: BeThrownWeaponAction.h:37
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
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