ASTEROIDS - ARRAY

At this point the asteroids contained all the behaviors it should have had in the game. So I created a prefab of the 3 asteroids by dragging and dropping it down to my prefabs folder in Project window. A new empty GameObject was created in the Hierarchy (goto Hierarchy --> Right-click --> Create Empty)

We have 3 different sizes and shapes of asteroids in the scene. So, an Array was used to store the collection of asteroids.

DECLARING AN ARRAY OF ASTEROIDS

INSTANTIATE RANDOM ASTEROIDS

RANDOM INDEX FOR ARRAY

RANDOM SPAWN POSITION