This commit is contained in:
2025-05-11 00:46:26 +08:00
parent 366f9e95ec
commit 618f75f911
2404 changed files with 154475 additions and 924730 deletions

View File

@@ -1,5 +1,4 @@
using System;
using Rewired;
using UnityEngine;
namespace UnityStandardAssets.Characters.FirstPerson
@@ -37,48 +36,48 @@ namespace UnityStandardAssets.Characters.FirstPerson
private bool m_cursorIsLocked = true;
private Player player;
// private Player player;
public void Init(Transform character, Transform camera)
{
m_CharacterTargetRot = character.localRotation;
m_CameraTargetRot = camera.localRotation;
player = ReInput.players.GetPlayer(0);
// player = ReInput.players.GetPlayer(0);
}
public void LookRotation(Transform character, Transform camera)
{
// if (!SRDebug.Instance.IsDebugPanelVisible && !SRDebug.Instance.IsDebugPanelVisible)
{
float num = Mathf.Clamp(player.GetAxis("cameraVerticalGamepad") * YSensitivity * 50f * Time.deltaTime + player.GetAxis("cameraVertical") * YSensitivity * 5f * Time.deltaTime, -10f, 10f);
float num2 = Mathf.Clamp(player.GetAxis("cameraHorizontalGamepad") * XSensitivity * 50f * Time.deltaTime + player.GetAxis("cameraHorizontal") * XSensitivity * 5f * Time.deltaTime, -10f, 10f);
if (invertMouseY)
{
num *= -1f;
}
if (invertMouseX)
{
num2 *= -1f;
}
RotYvalue = num2;
m_CharacterTargetRot *= Quaternion.Euler(0f, num2, 0f);
m_CameraTargetRot *= Quaternion.Euler(0f - num, 0f, 0f);
if (clampVerticalRotation)
{
m_CameraTargetRot = ClampRotationAroundXAxis(m_CameraTargetRot);
}
if (smooth)
{
character.localRotation = Quaternion.Slerp(character.localRotation, m_CharacterTargetRot, smoothTime * Time.deltaTime);
camera.localRotation = Quaternion.Slerp(camera.localRotation, m_CameraTargetRot, smoothTime * Time.deltaTime);
}
else
{
character.localRotation = m_CharacterTargetRot;
camera.localRotation = m_CameraTargetRot;
}
UpdateCursorLock();
}
// {
// float num = Mathf.Clamp(player.GetAxis("cameraVerticalGamepad") * YSensitivity * 50f * Time.deltaTime + player.GetAxis("cameraVertical") * YSensitivity * 5f * Time.deltaTime, -10f, 10f);
// float num2 = Mathf.Clamp(player.GetAxis("cameraHorizontalGamepad") * XSensitivity * 50f * Time.deltaTime + player.GetAxis("cameraHorizontal") * XSensitivity * 5f * Time.deltaTime, -10f, 10f);
// if (invertMouseY)
// {
// num *= -1f;
// }
// if (invertMouseX)
// {
// num2 *= -1f;
// }
// RotYvalue = num2;
// m_CharacterTargetRot *= Quaternion.Euler(0f, num2, 0f);
// m_CameraTargetRot *= Quaternion.Euler(0f - num, 0f, 0f);
// if (clampVerticalRotation)
// {
// m_CameraTargetRot = ClampRotationAroundXAxis(m_CameraTargetRot);
// }
// if (smooth)
// {
// character.localRotation = Quaternion.Slerp(character.localRotation, m_CharacterTargetRot, smoothTime * Time.deltaTime);
// camera.localRotation = Quaternion.Slerp(camera.localRotation, m_CameraTargetRot, smoothTime * Time.deltaTime);
// }
// else
// {
// character.localRotation = m_CharacterTargetRot;
// camera.localRotation = m_CameraTargetRot;
// }
// UpdateCursorLock();
// }
}
public void SetCursorLock(bool value)