Restricting outpost access

Now that we have an inventory keeping track of the power cells that we have collected, let's set up a game mechanic that forces the player to collect all four power cells before they may be granted access to the outpost.

We will begin by achieving this in code, then add two visual indicators for the player.

Firstly, in the form of a 2D HUD—this will be in the form of a GUITexture, the texture which will be dependent upon the charge variable in the Inventory script:

Restricting outpost access

Secondly, in the form of a generator model that will be placed next to the outPost object's door, the texture of which will also be swapped depending upon the ...

Get Unity 3.x Game Development Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.