Game Development Reference
In-Depth Information
The mechanism will work like this: When the player activates the EMP Tool,
a ghosted version of the EMP will appear centered on the screen. As the
character moves and moves his mouse, the ghosted EMP will crawl along
the surfaces of the level. When the player is happy with the placement, he
will click the mouse button and the real (armed) EMP will be placed and will
detonate after a short delay.
This is going to be an interesting problem to solve. It's going to require an
object to be instantiated once, and then moved around the scene based upon
where the player looks. Then, this object will need to be destroyed as another
object is created in its place. Then this last object will need to have scripts
attached to it activated after a short wait. Fun stuff—let's do it.
Step 1: Download and import the Unity package EMPs from the
supporting web site ( http://www.Creating3dGames.com ).
Why?
This will bring a few things into a Character Assets folder. It should bring
an .fbx EMP that was used to create EMP_Prefab and EMP_Ghost (both of
which are prefabs). The EMP_Prefab has attached to it a Detonator script
that is inactive (we'll activate it via script later). EMP_Ghost has a separate
shader that allows it to be semitransparent. There's nothing particularly
special about either, but they do use some shaders we haven't talked
about yet—feel free to explore them.
Step 2: Open Scene-EntryWay. Disable the fog (Edit>Render Settings) so
we can see the scene.
Step 3: Ensure that you have an entryway with a digital lock within the
scene ( Figure 15.24 ). Hopefully this was created in earlier steps if you're
using your own model. However, if you don't have one, or if you want
another, an EntryWayDoors Unity package is available on the supporting
web site ( http://www.Creating3dGames.com ).
Figure 15.24 EntryWay.
Search WWH ::




Custom Search