| 220 | } |
| 221 | |
| 222 | void Particle::destructionUpdate() { |
| 223 | if (destructionTime > 0) { |
| 224 | float destructionFactor = (timeToLive + destructionTime) / destructionTime; |
| 225 | if (destructionAction == DestructionAction::Shrink) { |
| 226 | size = baseSize * destructionFactor; |
| 227 | } else if (destructionAction == DestructionAction::Fade) { |
| 228 | color.setAlphaF(destructionFactor); |
| 229 | } else if (destructionAction == DestructionAction::Image) { |
| 230 | if (!destructionSet) { |
| 231 | size = 1.0f; |
| 232 | color = Color::White; |
| 233 | type = Particle::Type::Textured; |
| 234 | image = destructionImage; |
| 235 | angularVelocity = 0.0f; |
| 236 | length = 0.0f; |
| 237 | rotation = 0.0f; |
| 238 | destructionSet = true; |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | void Particle::initializeAnimation() { |
| 245 | if (!animation) { |