void Update()
{
//鼠标滚动缩放
float delta = Input.GetAxisRaw("Mouse ScrollWheel");
if (delta != 0)
{
isUdelta = true;
camera.orthographicSize -= delta * (camera.orthographicSize);
//计算缩放等级
Zoom = (camera.orthographicSize / 150);
if (delta > 0)
ResizeObjects.ForEach((l) => { if (l.gameObject.activeSelf == false) l.ToMax(); });
else
ResizeObjects.ForEach((l) => { if (l.gameObject.activeSelf == true) l.ToMin(); });
ResizeObjects.ForEach((l) =>
{
if (l.gameObject.activeSelf)
l.SetSetWidth();
});
isUdelta = false;
}
//鼠标右键移动
if (Input.GetMouseButton(2) && isUdelta == false)
{
camera.transform.Translate(camera.transform.right * -Input.GetAxis("Mouse X") * (camera.orthographicSize / 2) * 0.2f, Space.World);
camera.transform.Translate(camera.transform.up * -Input.GetAxis("Mouse Y") * (camera.orthographicSize / 2) * 0.2f, Space.World);
}
}