Game Development Reference
In-Depth Information
// C# user:
void 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;
}
9. Now, we are finished with the scripting part, so we will go back to the Unity edit-
or. Let's create the laser target scope. First, go to GameObject | Create Empty to
create an empty game object and name it LaserScope .
Search WWH ::




Custom Search