using System.Collections; using System.Collections.Generic; using UnityEngine; public class RoleMove : MonoBehaviour { public static RoleMove instance; public bool isup; //上梯子后停止移动 //private void Start() //{ // FirstPersonController.instance.playerCanMove = false; //} void Update() { instance = this; MouseScrollWheel(); } /// /// 上梯子后才能使用鼠标滑轮控制视角 /// public void MouseScrollWheel() { if (isup) { FirstPersonController.instance.playerCanMove = false; //通过鼠标滚轮放大和缩放视角 //放大视角 往前滑 if (Input.GetAxis("Mouse ScrollWheel") < 0) { if (Camera.main.fieldOfView <= 70) //小于一个放大范围后就不继续放大了 { Camera.main.fieldOfView += 5; } } //减小视角 往后滑 if (Input.GetAxis("Mouse ScrollWheel") > 0) { if (Camera.main.fieldOfView >= 30) { Camera.main.fieldOfView -= 5; } } } } }