Finishing Up the Player

You need to finish up just a few things in the player class before you're ready to begin using it. One of those things is to add the code that fires the bullets! You couldn't do it up to this point because the classes weren't defined, but now that you've implemented the bullet classes, this is the perfect time. What you want to do first is add a method to fire the round (Listing 15.8) to the player class.

Listing 15.8. Firing a Round
 /// <summary> /// Will add a new bullet to the list /// </summary> public void FireRound(Device device, Bullets list) { // Get the bullet start and velocity Vector3 bulletStart; Vector3 bulletVel; GetBulletStartLocation(out bulletStart, out bulletVel); // Finally add the new bullet list.Add(new ...

Get Beginning 3D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.