Putting the Pieces Together

Now that you have the special effects class implemented, you can go back to the game engine code file and implement the code there to make the game engine use these newly created special effects. First, you need to declare the class as a variable to the game engine:

// The special effects class
private SpecialEffects particleEffects = null;

Then, you create the special effects class. You should do this part in the LoadWorld method, directly after loading the level:

// Create the special effects class
particleEffects = new SpecialEffects(sampleFramework.Device);

Next, you want to ensure that the particles are updated every frame, so find the OnFrameMove method and add this code directly before updating the local ...

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.