Time for action – the ExplosionManager class
Add a new class called
ExplosionManager
to the Asteroid Belt Assault project.Add declarations to the
ExplosionManager
class:Private _texture As Texture2D Private pieceRectangles As List(Of Rectangle) = new List(Of Rectangle)() Private _pointRectangle As Rectangle Private minPieceCount As Integer = 3 Private maxPieceCount As Integer = 6 Private minPointCount As Integer = 20 Private maxPointCount As Integer = 30 Private durationCount As Integer = 90 Private explosionMaxSpeed As Single = 30 Private pieceSpeedScale As Single = 6 Private pointSpeedMin As Integer = 15 Private pointSpeedMax As Integer = 30 Private initialColor As Color = new Color(1.0F, 0.3F, 0.0F) * 0.5 Private finalColor As Color = new Color(0.0F, 0.0F, 0.0F) * 0 Private rand As Random = new Random() Private ExplosionParticles As List(Of Particle) = new List(Of Particle)()
Add a constructor to the
ExplosionManager
class:Public Sub New ( Texture As Texture2D, ...