diff --git a/Assets/Scripts/Pal3.Core/DataReader/Cpk/CpkArchive.cs b/Assets/Scripts/Pal3.Core/DataReader/Cpk/CpkArchive.cs index a0d97c71..b473e937 100644 --- a/Assets/Scripts/Pal3.Core/DataReader/Cpk/CpkArchive.cs +++ b/Assets/Scripts/Pal3.Core/DataReader/Cpk/CpkArchive.cs @@ -208,7 +208,7 @@ public byte[] ReadAllBytes(uint fileVirtualPathCrcHash) } else { - using var stream = new FileStream(_filePath, FileMode.Open, FileAccess.Read); + using FileStream stream = new(_filePath, FileMode.Open, FileAccess.Read); stream.Seek(entity.StartPos, SeekOrigin.Begin); byte[] buffer = new byte[entity.PackedSize]; _ = stream.Read(buffer.AsSpan()); diff --git a/Assets/Scripts/Pal3.Core/DataReader/Gdb/GdbFileReader.cs b/Assets/Scripts/Pal3.Core/DataReader/Gdb/GdbFileReader.cs index 3bf0dbc1..c33268cd 100644 --- a/Assets/Scripts/Pal3.Core/DataReader/Gdb/GdbFileReader.cs +++ b/Assets/Scripts/Pal3.Core/DataReader/Gdb/GdbFileReader.cs @@ -455,8 +455,7 @@ private static Dictionary GetCombatStat { combatStateImpacts[combatState] = new CombatStateImpact { - Type = combatStateImpactTypes.TryGetValue(combatState, out CombatStateImpactType impactType) ? - impactType : CombatStateImpactType.None, + Type = combatStateImpactTypes.GetValueOrDefault(combatState, CombatStateImpactType.None), Value = impactValue }; } diff --git a/Assets/Scripts/Pal3.Core/DataReader/Mv3/Mv3FileReader.cs b/Assets/Scripts/Pal3.Core/DataReader/Mv3/Mv3FileReader.cs index af435776..28ad368b 100644 --- a/Assets/Scripts/Pal3.Core/DataReader/Mv3/Mv3FileReader.cs +++ b/Assets/Scripts/Pal3.Core/DataReader/Mv3/Mv3FileReader.cs @@ -161,9 +161,8 @@ private static Mv3Mesh GetMv3Mesh(string name, int triangleIndex = 0; - for (int i = 0; i < attributes[0].IndexBuffers.Length; i++) + foreach (Mv3IndexBuffer indexBuffer in attributes[0].IndexBuffers) { - Mv3IndexBuffer indexBuffer = attributes[0].IndexBuffers[i]; for (int j = 0; j < 3; j++) { for (int k = 0; k < vertFrames.Length; k++) diff --git a/Assets/Scripts/Pal3.Game/Camera/CameraManager.cs b/Assets/Scripts/Pal3.Game/Camera/CameraManager.cs index 4ae59365..ea56ba92 100644 --- a/Assets/Scripts/Pal3.Game/Camera/CameraManager.cs +++ b/Assets/Scripts/Pal3.Game/Camera/CameraManager.cs @@ -67,16 +67,12 @@ public sealed class CameraManager : IDisposable, private const float SCENE_IN_DOOR_ROOM_FLOOR_HEIGHT = 1.6f; private const float CAMERA_DEFAULT_DISTANCE = 46f; private const float CAMERA_IN_DOOR_DISTANCE = 34f; - private const float CAMERA_ROTATION_SPEED_KEY_PRESS = 120f; + private const float CAMERA_ROTATION_SPEED_PER_SECOND_KEYBOARD = 120f; + private const float CAMERA_ROTATION_SPEED_PER_SECOND_MOUSE_SCROLL = 520f; private const float CAMERA_ROTATION_SPEED_DRAG = 10f; private const float CAMERA_SMOOTH_FOLLOW_TIME = 0.2f; private const float CAMERA_SMOOTH_FOLLOW_MAX_DISTANCE = 7f; - - #if UNITY_6000_0_OR_NEWER - private const float CAMERA_ROTATION_SPEED_SCROLL = 700f; - #else - private const float CAMERA_ROTATION_SPEED_SCROLL = 15f; - #endif + private static readonly Quaternion[] DefaultCameraRotations = { @@ -220,17 +216,18 @@ private void RotateCameraBasedOnUserInput(float deltaTime) { if (_inputActions.Gameplay.RotateCameraClockwise.inProgress) { - RotateToOrbitPoint(deltaTime * CAMERA_ROTATION_SPEED_KEY_PRESS); + RotateToOrbitPoint(deltaTime * CAMERA_ROTATION_SPEED_PER_SECOND_KEYBOARD); } else if (_inputActions.Gameplay.RotateCameraCounterClockwise.inProgress) { - RotateToOrbitPoint(-deltaTime * CAMERA_ROTATION_SPEED_KEY_PRESS); + RotateToOrbitPoint(-deltaTime * CAMERA_ROTATION_SPEED_PER_SECOND_KEYBOARD); } float mouseScroll = _inputActions.Gameplay.OnScroll.ReadValue(); if (mouseScroll != 0) { - RotateToOrbitPoint(mouseScroll * deltaTime * CAMERA_ROTATION_SPEED_SCROLL); + float direction = mouseScroll > 0 ? 1 : -1; + RotateToOrbitPoint(direction * deltaTime * CAMERA_ROTATION_SPEED_PER_SECOND_MOUSE_SCROLL); } if (!_isTouchEnabled) return;