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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.