修改相机滚轮无法放大问题

This commit is contained in:
康地林 2023-09-14 11:32:03 +08:00
parent bf398d3ad2
commit 8112365957
3 changed files with 35 additions and 9 deletions

View File

@ -371,7 +371,7 @@ public class FirstPersonController : MonoBehaviour
CheckGround();
fieldView = playerCamera.fieldOfView;
fieldView -= Input.GetAxis("Mouse ScrollWheel") * 8f;
fieldView -= Input.GetAxis("Mouse ScrollWheel") * 10f;
fieldView = Mathf.Clamp(fieldView, 20, 60);
playerCamera.fieldOfView = fieldView;

View File

@ -49326,11 +49326,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 1
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
@ -49346,7 +49346,7 @@ Canvas:
m_GameObject: {fileID: 772200474}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_RenderMode: 0
m_Camera: {fileID: 1897096268}
m_PlaneDistance: 1
m_PixelPerfect: 0
@ -49354,9 +49354,9 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 332
m_SortingOrder: 1
m_TargetDisplay: 0
--- !u!1 &772352036
GameObject:
@ -129227,6 +129227,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 72a1134478d9f7647812f295f1989d7d, type: 3}
m_Name:
m_EditorClassIdentifier:
CameraManager: {fileID: 1543654486}
g1: {fileID: 1576068766454268715, guid: 79771fed092ef2543b21938de3220a98, type: 3}
--- !u!4 &1965873574
Transform:
m_ObjectHideFlags: 0
@ -170818,6 +170820,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3350233854110697398, guid: 5a7d7e9bd76f93b418b1f916781feb6a, type: 3}
propertyPath: enableZoom
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3350233854110697404, guid: 5a7d7e9bd76f93b418b1f916781feb6a, type: 3}
propertyPath: m_Name
value: Player

View File

@ -1,5 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
public class GameManager : MonoBehaviour
@ -7,6 +10,8 @@ public class GameManager : MonoBehaviour
public static GameManager ins;
public CameraManager CameraManager;
List<GameObject> tools;
[SerializeField] GameObject g1;
char[] g2 = new char[7] {'(','C','l','o','n','e',')' };
public void Awake()
{
if (ins!=null)
@ -19,10 +24,25 @@ public class GameManager : MonoBehaviour
// Start is called before the first frame update
void Start()
{
ToolsShow(g1);
}
public void ToolsShow()
/// <summary>
/// ¹¤¾ßÉú³É·½·¨
/// </summary>
public void ToolsShow(GameObject tools)
{
GameObject temp = Instantiate(tools);
string name = Filter(temp.name,g2);
Debug.Log(name);
switch (temp.name)
{
default:
break;
}
}
public string Filter(string str, char[] charsToRemove)
{
return String.Concat(str.Split(charsToRemove.ToArray()));
}
}