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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access