So you don’t have to drag a new component to each skyscraper in the city, there is a script named “Target” that is already attached to each building/prefab. We’ll add a some code into this script that will allow the building to internally register when it has the user’s gaze and react when the Cardboard button is pressed while currently in focus. For this experience, we want the lasers to fire when the user is looking at a potential target and to cease from firing at the ground or sky. Since each building has this script, it’s also a good place to keep any information about the state of each building.
The script for the small robots is nearly identical to the building script except their HP value starts out at 20 rather than 60.