October 2017
Intermediate to advanced
548 pages
13h 23m
English
Now is a good time to add the BallGame component to our ball game.
The BallGame component is associated with each separate ball game. It uses the ThrowControl component to determine when the show is done and if the ball hit the goal. Then, it invokes a Won or Lost event accordingly.
We'll add a BallGame component to our Boxball game. When we add more games, such as basketball and football, they'll also have a BallGame component:
The full script is as follows:
File: BallGame.csusing UnityEngine; using UnityEngine.Events; public class BallGame : MonoBehaviour { public ...Read now
Unlock full access