4
Player Structure
A player can take on any form – humans, aliens, vehicles, and so forth. Designing a structure that can deal with all of them is a challenge. The way we need to store data, the types of data we need to store, the various types of movement code and weapons and so on, can soon become complicated.
A basic player using the framework in this book would be made up of a GameObject containing Unity-specific physics or collision Components, then four additional script Components (as seen in Figure 4.1):
-
The player controller
A controller specific to game requirements – this may have functions to deal with game-specific operations like opening doors or holding the player in place before the game starts and so on
-
A movement controller ...