Technical requirements
To get started:
- Download or clone the GitHub repository at https://github.com/PacktPublishing/C-Design-Patterns-with-Unity-First-Edition.
- Open the
Ch_02_Starter
project folder in Unity Hub. - Navigate to Assets | Scenes, and double-click on SplashScreen.
The starter project for this chapter has two scenes – a splash screen with the title of our little game and a button to start the adventure. When you click Start, the game transitions to a new scene, where you can move a capsule around a small arena and collect spheres.
As for the scripts:
Item.cs
is attached to eachItem
prefab that is responsible for destroying itself when there’s a collision.Manager.cs
stores our score and loads the next scene.Player.cs
is responsible for moving our character around the scene using the WASD or arrow keys.ScoreUI.cs
stores aText
object so that we can set an initial score value on our scene canvas...