Game Development Reference
In-Depth Information
on to the gameplay system for processing. Figure 5.3 visualizes how the bindings
are passed between the systems.
Figure 5.3 Proposed input system.
Although it might seem odd that all the bindings in the game, including actions
such as “Jump,” might be first processed by the UI, it provides a great deal of
flexibility. For example, in a tutorial it's common to have a dialog box that only
goes away once a particular action is performed. In this case, you could have the
“Press ... to Jump” dialog box pause the game and only go away once the button is
pressed.
The code for this system is not terribly complex and is provided in Listing 5.1 . If
you'd like to see a live implementation of a system very similar to this one, take
a look at InputManager.cs, which is provided in the source for Chapter 14 ' s tower
defense game.
Listing 5.1 A More Complex Input Manager
Click here to view code image
Search WWH ::




Custom Search