Game Development Reference
In-Depth Information
In the LevelPrep function, inside the if(levelManager) conditional, add
9.
// send the hide/show areas' current active states off to be stored
for (int x = 0 ; x < hideShows.Length ; x++) {
levelManager. areaVisibility [x] = hideShows[x].activeSelf;
}
10.
And create the function the LevelManager will call to set the objects'
active state:
public void LoadVis () {
// retrieve the hide/show areas' current states and apply them
for (int x = 0 ; x < hideShows.Length ; x++) {
hideShows[x].SetActive(levelManager. areaVisibility [x]);
}
}
11.
Save the script.
The rest of the code is added to the LevelManager script.
1.
In the LevelManager script, add the following variable:
public bool[] areaVisibility; // active state of the garden areas
In the ManageLevels function, directly below the if (currentLevel > 3) line,
add the following:
2.
// set the occlusion areas' visibility
GameObject.Find("Game Manager").GetComponent<GameMisc>().LoadVis();
3.
Save the script.
With the code in place in both scripts, you can fill in the new parameters.
1.
In the Game Manager's Game Misc component, set the Size of the new array
to 5 and load each of the objects affected by the occlusion culling system
into it (Figure 10-45 ).
Search WWH ::




Custom Search