Making the Turrets Go Boom
It has been quite some time since we paid much attention to the turrets. That's about to change. In order to get things exploding nicely, we will need to change three scripts: Turret.cs
, LaunchAction.cs
, and Missile.cs
. None of the changes are all that complicated or things that we haven't seen before:
- Let's start with
LaunchAction.cs
, which is on the turret object at the top of the turret prefab. At the top of the class, we'll add three new references to the existing ones:public GameObject lid; public AudioClip lidSFX; private float lidLiftTime = 1.5f; // new – object to instantiate public GameObject missilePrefab; // new – the instantiated object private GameObject missile; // new – the script...