Game Development Reference
In-Depth Information
At the top of the BundleManager script's OnCollisionEnter2D function, add:
6.
foreach(GameObject bun2D in buns2D) {
bun2D.GetComponent<BabyZBHandler>().Escape();
}
This foreach loop iterates through the array of gameObjects and calls the Escape function on the
object's BabyZBHandler script.
7.
Save the script, and click Play.
After the initial fly-by, the Baby ZBs bounce chaotically around the 2D screen with each drop
(Figure 9-49 ).
Figure 9-49. The bouncing baby zombie sprites
Now when you play through, shooting at the 3D zombie bunnies, you should note that you will have
a fly-through and drop of the 2D elements even after the 2D zombie bunny count has reached the
“can't reproduce” state you set in the ScoreKeeper script. You left it at 10 for ease of checking the
functionality. Let's get the stork fly-through respecting the condition as well.
Search WWH ::




Custom Search