Time for action – creating the CollisionManager class
Add a new class called
CollisionManager
to theAsteroidBeltAssault
class.Add declarations to the
CollisionManager
class:Private _asteroidManager As AsteroidManager Private _playerManager As PlayerManager Private _enemyManager as EnemyManager Private _explosionManager As ExplosionManager Private offScreen As Vector2 = new Vector2(-500, -500) Private shotToAsteroidImpact As Vector2 = new Vector2(0, -20) Private enemyPointValue As Integer = 100
Add a constructor to the
CollisionManager
class:Public Sub New( asteroidManager As AsteroidManager, playerManager As PlayerManager, enemyManager As EnemyManager, explosionManager As ExplosionManager) _asteroidManager = asteroidManager _playerManager = playerManager _enemyManager = enemyManager _explosionManager = explosionManager End Sub
What just happened?
Because it will be comparing various objects against each other, the CollisionManager
needs to know about most of...