ECM2
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user