September 2010
Beginner
384 pages
8h 49m
English
To make the explosion happen on the thing that hits the enemy ship, rather than on the enemy ship itself, we'll pass the position of the colliding Game Object to the Explode() function.
OnCollisionEnter function, pass the transform.position of the colliding object's Game Object to the Explode() function:Explode(col.gameObject.transform.position);
function Explode(pos:Vector3){
pos variable that receives the argument value:function Explode(pos:Vector3){ audio.PlayOneShot(audioClips[Random.Range(0,audioClips.length)]); Instantiate(explosion, ...Read now
Unlock full access