Emergency 20 Dokumentation  4.2.0
HelicopterSearchLightComponent.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 LinkComponent;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
50  static const uint32 COMPONENT_ID;
51 
52 
53  //[-------------------------------------------------------]
54  //[ Public methods ]
55  //[-------------------------------------------------------]
56  public:
65 
71 
72  void startFollowTarget();
73  void stopFollowTarget();
74 
75  uint64 getSearchLightEntityId() const;
76  void setSearchLightEntityId(uint64 cannonEntityId);
77  bool getIsSearchLight() const;
78  void setIsSearchLight(bool isSearchlight);
79  void setTargetEntityId(uint64 targetEntityId);
80 
81 
82  //[-------------------------------------------------------]
83  //[ Public virtual qsf::Component methods ]
84  //[-------------------------------------------------------]
85  public:
86  virtual void onSetSimulating(bool simulating) override;
87  virtual void serialize(qsf::BinarySerializer& serializer) override;
88 
89 
90  //[-------------------------------------------------------]
91  //[ Private methods ]
92  //[-------------------------------------------------------]
93  private:
94  void activateJob();
95  void deactivateJob();
96  void updateJob(const qsf::JobArguments& jobArguments);
97  void startupLights(const qsf::JobArguments& jobArguments);
98  void calculateFinalAngles();
99  void calculateCurrentAngles(float passedTime);
100  void calculateFinalRandomAngles();
101  void calculateCurrentRandomAngles(float passedTime);
102 
103  void setLocalRotation(float yaw, float pitch);
104 
105  void switchLight(bool active);
106 
107 
108  //[-------------------------------------------------------]
109  //[ Private data ]
110  //[-------------------------------------------------------]
111  private:
112  uint64 mSearchLightEntityId; // The id of the child entity of base part
113  bool mIsSearchLight; // Is this a searchlight or should it be used as camera
114 
115  qsf::WeakPtr<qsf::Entity> mSearchLightEntity;
116  qsf::WeakPtr<qsf::Entity> mTargetEntity;
117  qsf::WeakPtr<qsf::LinkComponent> mBaseLinkComponent;
118  qsf::WeakPtr<qsf::LinkComponent> mSearchLightLinkComponent;
119 
120  // Internal
121  float mCurrentYaw;
122  float mCurrentPitch;
123  float mFinalYaw;
124  float mFinalPitch;
125 
126  float mCurrentRandYaw;
127  float mCurrentRandPitch;
128  float mFinalRandYaw;
129  float mFinalRandPitch;
130 
131  bool mIsFollowingTarget;
132  bool mIsSearchLightInFinalRotation;
133  bool mIsRandomInZeroRotation;
134  qsf::JobProxy mUpdateJobProxy;
135  qsf::JobProxy mStartupJobProxy;
136 
137 
138  //[-------------------------------------------------------]
139  //[ CAMP reflection system ]
140  //[-------------------------------------------------------]
141  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
142 
143 
144  };
145 
146 
147 //[-------------------------------------------------------]
148 //[ Namespace ]
149 //[-------------------------------------------------------]
150 } // em5
151 
152 
153 //[-------------------------------------------------------]
154 //[ CAMP reflection system ]
155 //[-------------------------------------------------------]
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
Definition: HelicopterSearchLightComponent.h:42
Prototype class.
Definition: Prototype.h:100
static const uint32 COMPONENT_ID
"em5::HelicopterSearchLightComponent" unique component ID
Definition: HelicopterSearchLightComponent.h:50
Binary serializer class.
Definition: BinarySerializer.h:35