Skip to Content
Augmented Reality for Developers
book

Augmented Reality for Developers

by Jonathan Linowes, Krystian Babilinski
October 2017
Intermediate to advanced
548 pages
13h 23m
English
Packt Publishing
Content preview from Augmented Reality for Developers

Game controller

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:

  1. In the root of the Hierarchy, create an empty game object, name it GameController.
  2. And reset its Transform.
  3. In the Project Assetts/ARPlayBall/Scripts/ folder create a new C# script named GameController and drag it onto GameController as a component.

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); ...
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.
Start your free trial

You might also like

Augmented Reality Game Development

Augmented Reality Game Development

Micheal Lanham
Augmented Reality

Augmented Reality

Joseph Rampolla, Greg Kipper

Publisher Resources

ISBN: 9781787286436Supplemental Content