Game Development Reference
In-Depth Information
}
}
8. Go inside the Update() function to make our robot rotate around while aiming
and show the laser target scope. Let's go inside the if (!_isJumping) condi-
tion and enter the following highlighted code:
// Unity JavaScript user:
function Update () {
if (!_isJumping) {
_isAiming = (Input.GetKey(KeyCode.E));
if (_isAiming) {
if (laser != null) {
laser.gameObject.SetActive(true);
laser.SetPosition(1,new
Vector3(GUN_LASER_DISTANCE,0,0));
}
_mouseLook.enabled = true;
_isShot = Input.GetButtonDown("Fire1");
} else {
if (laser != null) {
laser.gameObject.SetActive(false);
}
_mouseLook.enabled = false;
if (_motionState == MOTION_STATE.GROUND) {
}
}
} else {
// TODO - Reset Aiming
if (laser != null) {
laser.gameObject.SetActive(false);
}
_mouseLook.enabled = false;
}
}
Search WWH ::




Custom Search