Game Development Reference
In-Depth Information
5. Go to the New3PSController script to add the highlighted code between the
maxRotateY and mouseLook parameters (before the Awake() funcion),
as shown next:
//Camera Rotation Limit
public var minRotateY : float = -15;
public var maxRotateY : float = 60;
//Scope UI
public var scopeUI : GUITexture;
//Rocket Launcher
public var rocketLauncher : RocketLauncher;
//Shot Params
private var b_isPrepare : boolean = false;
private var b_isShot : boolean = false;
//Mouse Look
private var mouseLook : MouseLook_JS;
//Character Motor
private var motor : CharacterMotor;
6. Then, go to the Update() funcion and add the code before and inside if
(Input.GetKey(KeyCode.E)) { (ater if (directionVector != Vector3.
zero) { statement) as highlighted:
if (directionVector != Vector3.zero) {
}
//Reload the rocket bullet
if (Input.GetKey(KeyCode.R)) {
BroadcastMessage("Reload");
}
if (Input.GetKey(KeyCode.E)) {
//Show the Scope UI
scopeUI.enabled = true;
//Set the maximum and minimum limit rotation on Y-axis for the
main camera
//Set the maximum and minimum limit rotation on Y-axis for the
main camera
mouseLook.minimumY = minRotateY;
mouseLook.maximumY = maxRotateY;
//Checking if the character is playing the shot animation
 
Search WWH ::




Custom Search