Game Development Reference
In-Depth Information
collider, it will be activated. Next, you go through the collider that opens and closes the gates. You
then go through the inner occlusion collider on the other side. The area you just left is turned on
(it has remained on), and as you go through the outer collider, it is turned off (Figure 7-19 ).
Figure 7-19. An Area/Door/Area occlusion scheme
Arrays and Looping
With the script, you will be introduced to a new concept, that of arrays. Arrays are a means of storing
multiple objects. In C#, the contents must all be of the same type. To perform your occlusion culling,
you will be activating and deactivating the various areas and walls. A deactivated gameObject
cannot be “found” with GameObject.Find(<object name>) , so it must be identified to the script
before the Start function, where you typically set the active state of an object. Because each
instance of the script will have to turn different gameObjects off and on, you will keep a list of the
objects to be turned on and a list of objects to be turned off.
1.
Create a Cube, 2 x 2.5 x 0.5 , about a meter in front of Common Wall 2 on the
garden side (Figure 7-20 ).
 
Search WWH ::




Custom Search