Game Development Reference
In-Depth Information
Chapter 4
Power-Ups and Singletons
CMOD will feature a total of four different power-up types, scattered around the level for collection.
First, the game-critical power-up of Cash (see Figure 4-1 ). Each level features multiple Cash
Power-Ups, and when all of these are collected without the Player dying, the level is classified
as complete. Second, a weapon-upgrade power-up that equips the Player with the gun weapon.
Third, an ammo-restore power-up to replenish the gun ammo back to maximum. And fourth, a
health-restore power-up to restore Player health back to maximum. All four of these power-ups
will be collected and applied when the Player collides with (or walks into) them. To implement
this behavior efficiently and to integrate it with the NotificationsManager (coded in the previous
chapter), we'll make use of a very powerful type of C# object, known as a Singleton . This object
was discussed briefly in the previous chapter, but here we'll examine it in more detail. So let's get
started at creating power-up objects for CMOD!
113
 
Search WWH ::




Custom Search