Game Development Reference
In-Depth Information
Step 4: Delete the old First Person Controller that is placed within this
scene (the one we worked with back with sounds).
Step 5: Place our newly constructed FPC_AegisChung prefab (drag it from
the Project panel into the Scene window). Put it back in about the same
place as the other unit ( Figure 15.25 ).
Figure 15.25 Placement of FPC_
AegisChung prefab, which replaces
First Person Controller that was in
the scene.
Step 6: Turn off the flashlight. Select it and deactivate it in the Inspector
panel. You may need to also deactivate the rifle and knife again.
Step 7: Open AC_ToolFunctionalityScript.
Step 8: Declare two variables: empGhost and empReal. Do this at the top
of the script. Both should be typed as GameObject:
var empGhost : GameObject;
var empReal : GameObject;
Why?
These two objects don't exist when the game starts—they are not part of
the scene. But by declaring these public variables, we can populate them
with assets from the Project panel so Unity knows what to instantiate
when the time comes.
Step 9: Declare two private variables (placingEMP and placedEMP) that
will act as the holders of the instantiated ghost version and placed version.
Again add this to the top of the script:
private var placingEMP : GameObject;
private var placedEMP : GameObject;
Step 10: Declare a Boolean variable for when the EMP is active
(empActive). Create a second one for when the EMP Ghost is active
(empGhostActive). I like to group my variable declarations, so the total
variable declaration pack looks something like this:
Search WWH ::




Custom Search