狗屎Minimax坏我代码

This commit is contained in:
SoulliesOfficial
2026-04-18 13:57:19 -04:00
parent 41140a2017
commit 7379583165
473 changed files with 34480 additions and 8069 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
namespace SickscoreGames.ExampleScene
{
@@ -14,37 +15,52 @@ namespace SickscoreGames.ExampleScene
public Vector2 rotationLimitsY = new Vector2 (-60f, 60f);
public float rotationSmooth = 8f;
private Quaternion rotationOrigin;
private float currentRotationX, currentRotationY = 0f;
private Quaternion _rotationOrigin;
private float _currentRotationX, _currentRotationY = 0f;
#endregion
#region Main Methods
void Awake ()
{
rotationOrigin = transform.localRotation;
_rotationOrigin = transform.localRotation;
#if ENABLE_INPUT_SYSTEM
sensitivityX /= 4;
sensitivityY /= 4;
#endif
}
void Update ()
{
// get input
float mouseX = Input.GetAxis ("Mouse X");
float mouseY = Input.GetAxis ("Mouse Y");
float mouseX = 0f;
float mouseY = 0f;
#if ENABLE_INPUT_SYSTEM
if (Mouse.current != null)
{
mouseX = Mouse.current.delta.x.ReadValue();
mouseY = Mouse.current.delta.y.ReadValue();
}
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
mouseX = Input.GetAxis ("Mouse X");
mouseY = Input.GetAxis ("Mouse Y");
#endif
// calculate and apply rotations
if (axes == RotationAxes.MouseX) {
currentRotationX += mouseX * sensitivityX;
currentRotationX = this.ClampAngle (currentRotationX, rotationLimitsX.x, rotationLimitsX.y);
Quaternion rotationX = Quaternion.AngleAxis (currentRotationX, Vector3.up);
transform.localRotation = Quaternion.Lerp (transform.localRotation, rotationOrigin * rotationX, rotationSmooth * Time.deltaTime);
_currentRotationX += mouseX * sensitivityX;
_currentRotationX = this.ClampAngle (_currentRotationX, rotationLimitsX.x, rotationLimitsX.y);
Quaternion rotationX = Quaternion.AngleAxis (_currentRotationX, Vector3.up);
transform.localRotation = Quaternion.Lerp (transform.localRotation, _rotationOrigin * rotationX, rotationSmooth * Time.deltaTime);
} else {
currentRotationY += mouseY * sensitivityY;
currentRotationY = this.ClampAngle (currentRotationY, rotationLimitsY.x, rotationLimitsY.y);
Quaternion rotationY = Quaternion.AngleAxis (-currentRotationY, Vector3.right);
transform.localRotation = Quaternion.Lerp (transform.localRotation, rotationOrigin * rotationY, rotationSmooth * Time.deltaTime);
_currentRotationY += mouseY * sensitivityY;
_currentRotationY = this.ClampAngle (_currentRotationY, rotationLimitsY.x, rotationLimitsY.y);
Quaternion rotationY = Quaternion.AngleAxis (-_currentRotationY, Vector3.right);
transform.localRotation = Quaternion.Lerp (transform.localRotation, _rotationOrigin * rotationY, rotationSmooth * Time.deltaTime);
}
}
#endregion