38 lines
955 B
C#
38 lines
955 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class AnotherScenes : MonoBehaviour
|
||
|
|
{
|
||
|
|
public Camera camera;
|
||
|
|
int i=0;
|
||
|
|
// Start is called before the first frame update
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
if (Input.GetMouseButtonDown(1))
|
||
|
|
{
|
||
|
|
if (i == 0)Screen.SetResolution(900, 450, false);
|
||
|
|
if (i == 1)Screen.SetResolution(1800, 1080, false);
|
||
|
|
if (i == 2)Screen.SetResolution(3000, 1800, false);
|
||
|
|
i++;
|
||
|
|
} // 1代表右键
|
||
|
|
|
||
|
|
// 获取鼠标滚轮的输入
|
||
|
|
float scroll = Input.GetAxis("Mouse ScrollWheel");
|
||
|
|
|
||
|
|
// 计算新的视野
|
||
|
|
if (scroll != 0f)
|
||
|
|
{
|
||
|
|
camera.fieldOfView -= scroll * 10f;
|
||
|
|
// 限制视野范围
|
||
|
|
camera.fieldOfView = Mathf.Clamp(camera.fieldOfView, 15f, 120f);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|