Graphics Reference
In-Depth Information
Scene manager
Players
Game controller
(Depending on the requirements of the
specific game, the game controller may
either persist across scenes or be generated
per scene)
AI and enemies etc.
Game environment
Sound
manager
UI manager
Manager and control objects
Scene objects
Figure 2.1 Diagram of the game framework.
sound manager creates one individual AudioSource per sound in the array. When
we need to play a sound, the index number referring to a sound's place in the array
is passed to the manager. It uses the sound's individual AudioSource to play the
source, which helps to alleviate problems that may be caused by playing too many
sound files from a single source.
5. Players
Players may already be present in the game scene or may be instantiated by the
game controller. The players have a relatively complex structure that will be
explored later in Chapter 3.
6. AI and Enemies
As with players, AI-controlled characters or enemies may already be present in
the scene at load time or they may be created at runtime by the game controller or
other script.
Although you may choose to work with your own framework, understanding the one
used in this topic will help in seeing how the components work alongside each other and
how they work together. To maximize flexibility, the base classes need to be able to accom-
modate a host of different configurations. For example, a player control script should allow
for input to be passed in from another script so that control systems may easily be switched
out. The main player script does not need to know where the input is coming from, but it
needs to provide a common interface for an input script to communicate with. The input
script may take its input from the keyboard, mouse, artificial intelligence, networked input,
etc., and just as long as a common interface is used to communicate with the player control-
ler; it doesn't matter to the player controller as to where the input actually comes from.
Search WWH ::




Custom Search