October 2017
Intermediate to advanced
548 pages
13h 23m
English
The role of the game controller is to keep score and other game-wide features. For now, we'll just keep score. Let's add that as follows:
Open the GameController script for editing as follows:
File: GameController.csusing UnityEngine; using UnityEngine.UI; public class GameController : MonoBehaviour { public int hitPoints = 10; public int missPoints = -2; public BallGame ballGame; public Text scoreDisplay; private int playerScore; void Start() { ballGame.OnGoalWon.AddListener(WonGoal); ...