Time for action – the GameEntity class
To add a class for implementing the common functionality in Mars Runner, perform the following steps:
1. Add a new class file called
GameEntity.cs
to theMars Runner
project.2. Add the following
using
directives at the beginning of theGameEntity
class file:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics;
3. Add fields to the
GameEntity
class as follows:#region Fields protected Model model; protected GraphicsDevice device; protected Vector3 position = Vector3.Zero; protected float scale = 1.0f; protected float yaw = 0f; protected float pitch = 0f; protected float roll = 0f; protected Dictionary<string, Matrix> baseTransforms = new Dictionary<string, Matrix>(); protected Dictionary<string, Matrix> currentTransforms = new Dictionary<string, Matrix>(); protected Matrix[] boneTransforms; protected Vector3 minVector; protected Vector3 maxVector; protected Vector3 drawOffset = Vector3.Zero; #endregion...