Emergency 20 Dokumentation  4.2.0
FireComponent-inl.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Namespace ]
6 //[-------------------------------------------------------]
7 namespace em5
8 {
9 
10 
11  //[-------------------------------------------------------]
12  //[ Public static methods ]
13  //[-------------------------------------------------------]
15  {
16  return (fireState == FIRESTATE_SMALLFIRE || fireState == FIRESTATE_LARGEFIRE);
17  }
18 
19 
20  //[-------------------------------------------------------]
21  //[ Public methods ]
22  //[-------------------------------------------------------]
24  {
25  return mComplexFireComponent;
26  }
27 
28  inline float FireComponent::getEnergy() const
29  {
30  return mFireEnergy;
31  }
32 
33  inline void FireComponent::setEnergy(float energy)
34  {
35  mFireEnergy = energy;
36  }
37 
38  inline float FireComponent::getTotalDamage() const
39  {
40  return mTotalDamage;
41  }
42 
43  inline void FireComponent::setTotalDamage(float damage)
44  {
45  mTotalDamage = damage;
46  }
47 
49  {
50  return mFireState;
51  }
52 
53  inline float FireComponent::getHardRadius() const
54  {
55  return mHardRadius;
56  }
57 
58  inline void FireComponent::setHardRadius(float hardRadius)
59  {
60  if (mHardRadius != hardRadius)
61  {
62  // Soft radius must be bigger or equal than the hard radius
63  if (isRunning() && hardRadius > mSoftRadius)
64  {
65  // Deny bigger values
66  mHardRadius = mSoftRadius;
67  }
68  else
69  {
70  mHardRadius = hardRadius;
71  }
72 
73  // Promote the property change
75  }
76  }
77 
78  inline void FireComponent::setSoftRadius(float softRadius)
79  {
80  if (mSoftRadius != softRadius)
81  {
82  // Soft radius must be bigger or equal than the hard radius
83  if (isRunning() && softRadius < mHardRadius)
84  {
85  // Deny smaller values
86  mSoftRadius = mHardRadius;
87  }
88  else
89  {
90  mSoftRadius = softRadius;
91  }
92 
93  // Promote the property change
95  }
96  }
97 
98  inline float FireComponent::getSoftRadius() const
99  {
100  return mSoftRadius;
101  }
102 
104  {
105  return mPlayAudio;
106  }
107 
108  inline void FireComponent::setPlayAudio(bool playAudio)
109  {
110  mPlayAudio = playAudio;
111  }
112 
113  inline bool FireComponent::isIntact() const
114  {
115  return mInternalFlags.isSet(FLAG_INTACT);
116  }
117 
118  inline bool FireComponent::isBurning() const
119  {
120  return internalIsBurning();
121  }
122 
123  inline bool FireComponent::isBurned() const
124  {
125  return internalIsBurned();
126  }
127 
128  inline bool FireComponent::isBurnable() const
129  {
130  return isActive();
131  }
132 
134  {
135  return mExtinguishBlocked;
136  }
137 
138  inline void FireComponent::setExtinguishBlocked(bool extinguishBlocked)
139  {
140  mExtinguishBlocked = extinguishBlocked;
141  }
142 
143 
144  //[-------------------------------------------------------]
145  //[ Private methods ]
146  //[-------------------------------------------------------]
147  inline bool FireComponent::isExploding() const
148  {
149  return mIsExploding;
150  }
151 
152  inline void FireComponent::setIsExploding(bool isExploded)
153  {
154  mIsExploding = isExploded;
155  }
156 
157  inline bool FireComponent::internalIsBurning() const
158  {
159  return isBurningFireState(mFireState);
160  }
161 
162  inline bool FireComponent::internalIsBurned() const
163  {
164  return (mFireState == FIRESTATE_DESTROYED);
165  }
166 
167 
168  //[-------------------------------------------------------]
169  //[ CAMP reflection system ]
170  //[-------------------------------------------------------]
171  inline std::size_t FireComponent::EntityIdArrayInterface::size() const
172  {
173  return getVariable().size();
174  }
175 
176  inline const uint64& FireComponent::EntityIdArrayInterface::get(std::size_t index) const
177  {
178  return getVariable()[index];
179  }
180 
181  inline void FireComponent::EntityIdArrayInterface::set(std::size_t index, const uint64& value)
182  {
183  getVariable()[index] = value;
184  }
185 
186  inline void FireComponent::EntityIdArrayInterface::insert(std::size_t before, const uint64& value)
187  {
188  getVariable().insert(getVariable().begin() + before, value);
189  }
190 
191  inline void FireComponent::EntityIdArrayInterface::remove(std::size_t index)
192  {
193  getVariable().erase(getVariable().begin() + index);
194  }
195 
196 
197 //[-------------------------------------------------------]
198 //[ Namespace ]
199 //[-------------------------------------------------------]
200 } // em5
Definition: ActionPriority.h:13
bool isActive() const
Return whether or not the component is considered to be active.
Definition: Component-inl.h:42
Entity is not burning, but completely destroyed by fire; it can't start burning again because there's...
Definition: FireComponent.h:93
float getTotalDamage() const
Return the amount of energy the fire has damage the entity.
Definition: FireComponent-inl.h:38
void setTotalDamage(float damage)
Set the total damage value of the entity, if higher than getLife() of "em5::FireMaterial", entity is destroyed.
Definition: FireComponent-inl.h:43
void setEnergy(float energy)
Set the energy of the fire.
Definition: FireComponent-inl.h:33
bool isBurnable() const
Returns "true" if the fire component is burnable at all.
Definition: FireComponent-inl.h:128
static const uint32 SOFT_RADIUS
Definition: FireComponent.h:86
float getSoftRadius() const
Return the soft fire radius in meters; objects inside the soft radius take less damage fire damage...
Definition: FireComponent-inl.h:98
bool isExtinguishBlocked() const
Definition: FireComponent-inl.h:133
FireState
Definition: FireComponent.h:88
bool getPlayAudio()
Returns if fire sounds are playing for this component.
Definition: FireComponent-inl.h:103
FireState getFireState() const
Return the current fire state.
Definition: FireComponent-inl.h:48
virtual bool isBurned() const override
Returns "true" if the total amount of material energy is used; in this case the fire is over...
Definition: FireComponent-inl.h:123
float getHardRadius() const
Return the hard fire radius in meters; objects inside the hard radius take full fire damage...
Definition: FireComponent-inl.h:53
EMERGENCY 5 complex fire component class.
Definition: ComplexFireComponent.h:50
void setHardRadius(float hardRadius)
Set the hard fire radius.
Definition: FireComponent-inl.h:58
bool isRunning() const
Return whether or not the component is up-and-running.
Definition: Component-inl.h:67
virtual bool isBurning() const override
Return "true" if the fire is active, in this case the fire will charge by themselves.
Definition: FireComponent-inl.h:118
uint64_t uint64
Definition: PlatformTypes.h:184
float getEnergy() const
Return the energy of the fire.
Definition: FireComponent-inl.h:28
static const uint32 HARD_RADIUS
Definition: FireComponent.h:85
static bool isBurningFireState(FireState fireState)
Definition: FireComponent-inl.h:14
void setPlayAudio(bool playAudio)
Set if fire sounds are playing for this component.
Definition: FireComponent-inl.h:108
ComplexFireComponent * getComplexFireComponent() const
Return the complex fire component this belongs to.
Definition: FireComponent-inl.h:23
void promotePropertyChange(uint32 propertyId)
A component property value was changed.
void setSoftRadius(float softRadius)
Set the soft fire radius.
Definition: FireComponent-inl.h:78
Entity is burning with a small fire, i.e. it's not burning very hot yet.
Definition: FireComponent.h:91
bool isSet(ENUM flag) const
Check whether a certain flag is set.
Definition: EnumBitmask.h:118
Entity is burning with a large fire, i.e. it's burning relatively hot now.
Definition: FireComponent.h:92
void setExtinguishBlocked(bool extinguishBlocked)
Definition: FireComponent-inl.h:138
bool isIntact() const
Return if the entity is still intact, i.e. has not burned before.
Definition: FireComponent-inl.h:113