Emergency 20 Dokumentation  4.2.0
WaterCannonComponent.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 #include <qsf/job/JobProxy.h>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace qsf
23 {
24  class TransformComponent;
25  class LinkComponent;
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Classes ]
38  //[-------------------------------------------------------]
44  {
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public definitions ]
49  //[-------------------------------------------------------]
50  public:
51  static const uint32 COMPONENT_ID;
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public methods ]
56  //[-------------------------------------------------------]
57  public:
65  inline explicit WaterCannonComponent(qsf::Prototype* prototype);
66 
71  inline virtual ~WaterCannonComponent();
72 
73  inline uint64 getCannonEntityId() const;
74  void setCannonEntityId(uint64 cannonEntityId);
75 
76  uint64 getTargetEntityId() const;
77  void setTargetEntityId(uint64 targetEntityId);
78 
79  inline void setIsOnBoat(bool isOnBoat);
80 
81  bool getIsCannonInFinalRotation() const;
82 
83 
84  //[-------------------------------------------------------]
85  //[ Public virtual qsf::Component methods ]
86  //[-------------------------------------------------------]
87  public:
88  virtual void serialize(qsf::BinarySerializer& serializer) override;
89 
90 
91  //[-------------------------------------------------------]
92  //[ Protected virtual qsf::Component methods ]
93  //[-------------------------------------------------------]
94  protected:
95  virtual void onSetSimulating(bool simulating) override;
96 
97 
98  //[-------------------------------------------------------]
99  //[ Private methods ]
100  //[-------------------------------------------------------]
101  private:
102  void updateJob(const qsf::JobArguments& jobArguments);
103  void setLocalRotation(float yaw, float pitch);
104 
105 
106  //[-------------------------------------------------------]
107  //[ Private data ]
108  //[-------------------------------------------------------]
109  private:
110  uint64 mCannonEntityId;
111  qsf::WeakPtr<qsf::Entity> mTargetEntity;
112  qsf::WeakPtr<qsf::TransformComponent> mTargetTransformComponent;
113  qsf::WeakPtr<qsf::TransformComponent> mCannonTransformComponent;
114  qsf::WeakPtr<qsf::LinkComponent> mCannonLinkComponent;
115  qsf::WeakPtr<qsf::LinkComponent> mBaseLinkComponent;
116  float mFinalYaw;
117  float mFinalPitch;
118  bool mIsCannonInFinalRotation;
119  bool mIsOnBoat;
120 
121  // Internal
122  qsf::JobProxy mUpdateJobProxy;
123 
124 
125  //[-------------------------------------------------------]
126  //[ CAMP reflection system ]
127  //[-------------------------------------------------------]
128  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
129 
130 
131  };
132 
133 
134 //[-------------------------------------------------------]
135 //[ Namespace ]
136 //[-------------------------------------------------------]
137 } // em5
138 
139 
140 //[-------------------------------------------------------]
141 //[ Implementation ]
142 //[-------------------------------------------------------]
144 
145 
146 //[-------------------------------------------------------]
147 //[ CAMP reflection system ]
148 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Abstract component class.
Definition: Component.h:105
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
uint64_t uint64
Definition: PlatformTypes.h:184
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
#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
Prototype class.
Definition: Prototype.h:100
static const uint32 COMPONENT_ID
"em5::WaterCannonComponent" unique component ID
Definition: WaterCannonComponent.h:51
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 water cannon component. Consists in a cannon part with this component and an optional can...
Definition: WaterCannonComponent.h:43