Emergency 20 Dokumentation  4.2.0
BloodPuddleComponent.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 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Public definitions ]
39  //[-------------------------------------------------------]
40  public:
41  static const uint32 COMPONENT_ID;
42 
43 
44  //[-------------------------------------------------------]
45  //[ Public static methods ]
46  //[-------------------------------------------------------]
47  public:
58  static const qsf::Entity& createBloodPuddleEntity(qsf::Entity& bloodSourceEntity);
59 
60 
61  //[-------------------------------------------------------]
62  //[ Public methods ]
63  //[-------------------------------------------------------]
64  public:
72  explicit BloodPuddleComponent(qsf::Prototype* prototype);
73 
78  virtual ~BloodPuddleComponent();
79 
84  void setBloodFromEntityId(uint64 entityid);
85 
90  void setMaxDistanceToBloodSourceToGrow(float distance);
91 
103  void setGrowStayLayTime(qsf::Time timeToGrow, qsf::Time timeToLay, qsf::Time timeToFade);
104 
109  void fadeOutNow();
110 
111 
112  //[-------------------------------------------------------]
113  //[ Public virtual qsf::Component methods ]
114  //[-------------------------------------------------------]
115  public:
116  virtual void serialize(qsf::BinarySerializer& serializer) override;
117 
118 
119  //[-------------------------------------------------------]
120  //[ Protected virtual qsf::Component methods ]
121  //[-------------------------------------------------------]
122  protected:
123  virtual bool onStartup() override;
124  virtual void onShutdown() override;
125  virtual void onSetActive(bool active) override;
126 
127 
128  //[-------------------------------------------------------]
129  //[ Private methods ]
130  //[-------------------------------------------------------]
131  private:
132  void updateBloodPuddle(const qsf::JobArguments& jobArguments);
133 
134  static float lerp(float f1, float f2, float a);
135 
136 
137  //[-------------------------------------------------------]
138  //[ Private data ]
139  //[-------------------------------------------------------]
140  private:
141  qsf::JobProxy mUpdateJobProxy;
142  qsf::Time mTimePassed;
143  uint64 mBloodFromEntityId;
144  qsf::Time mTimeToGrowFromStart;
145  qsf::Time mTimeToLayFromStart;
146  qsf::Time mTimeToFadeFromStart;
147  float mAlphaGrow;
148  float mMaxDistanceToBloodSourceToGrow;
149 
150 
151  //[-------------------------------------------------------]
152  //[ CAMP reflection system ]
153  //[-------------------------------------------------------]
154  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
155 
156 
157  };
158 
159 
160 //[-------------------------------------------------------]
161 //[ Namespace ]
162 //[-------------------------------------------------------]
163 } // em5
164 
165 
166 //[-------------------------------------------------------]
167 //[ CAMP reflection system ]
168 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
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
static const uint32 COMPONENT_ID
unique component ID
Definition: BloodPuddleComponent.h:41
Blood puddle component class.
Definition: BloodPuddleComponent.h:33
#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
Binary serializer class.
Definition: BinarySerializer.h:35
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32