Time for action – the ShotManager class
To manage how the shots will function in the world, perform the following steps:
1. Add a new class file called
ShotManager.cs
to theMars Runner
project.2. Add the following
using
directives at the beginning of theShotManager
class file:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics;
3. Add fields to the
ShotManager
class as follows:#region Fields List<PlayerShot> playerShots = new List<PlayerShot>(); List<EnemyShot> enemyShots = new List<EnemyShot>(); Model shotModel; GraphicsDevice device; #endregion
4. Add a constructor to the
ShotManager
class as follows:#region Constructor public ShotManager(GraphicsDevice device, Model model) { shotModel = model; this.device = device; } #endregion
5. Add the
Helper Methods
region to theShotManager
class, which contains methods to add shots to the shot lists as follows:#region Helper Methods public void AddPlayerShot(Vector3 position) { bool...