Iteration 4 over Assets/Scripts (no component/file splits, no Unity assets touched): Dedup: - Route inline cursor-release, material guards, Ctrl-held and undo/redo input through existing InputUtil / SetMatFloat helpers - Add ungated InputUtil.KeyPressedThisFrame; GameplayKeyPressed builds on it - Unify FindDeep/FindDeepChild into GeometryUtil.FindDeep Dead code / stale docs: - Remove unused code-gen bake path (HsvColorPicker.Build, PaintHud factory) - Drop unreferenced symbols (SubPhaseChanged event, LocalPhaseDuration, IsLocalSceneMain, MouseSensitivity.Changed, IsPaused, InSession, NetworkControlled, PreviousPose, JointCount, voxel-count accessors) - Fix incorrect PlayerRole / PaintHud / Pick / PlayerPose docs Perf / robustness (behaviour-neutral): - ConcealmentMeter.Evaluate: reuse vertex/topology buffers, two-pointer crossing count - BuildMeshCaches: alloc-free vertex copy, cached topology/UVs - Guard all PlayerPaintSync LogSync sites behind logSync - Cache LocalViewerIsHunter / controller / CanShoot / TypingGuard lookups; dedup LocalIsHunter with MatchHud - Change-guard RefreshEmissionColor and HeroCutout.Disarm - Cache scene/countdown string comparisons per frame - Grow NonAlloc buffers and log-once on saturation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
/// Global mouse look-around sensitivity multiplier, shared by every camera
|
|
/// controller (FreeCam, FirstPerson, ThirdPersonOrbit). 1 = unchanged baseline.
|
|
/// Persisted per-machine via PlayerPrefs so the setting survives restarts.
|
|
public static class MouseSensitivity
|
|
{
|
|
public const float Default = 1f;
|
|
public const float Min = 0.1f;
|
|
public const float Max = 4f;
|
|
|
|
const string PrefKey = "Settings.MouseSensitivity";
|
|
|
|
static bool _loaded;
|
|
static float _multiplier = Default;
|
|
|
|
public static float Multiplier
|
|
{
|
|
get
|
|
{
|
|
if (!_loaded)
|
|
{
|
|
_loaded = true;
|
|
_multiplier = Mathf.Clamp(PlayerPrefs.GetFloat(PrefKey, Default), Min, Max);
|
|
}
|
|
return _multiplier;
|
|
}
|
|
set
|
|
{
|
|
float v = Mathf.Clamp(value, Min, Max);
|
|
_loaded = true;
|
|
if (Mathf.Approximately(v, _multiplier)) return;
|
|
_multiplier = v;
|
|
PlayerPrefs.SetFloat(PrefKey, v);
|
|
// Flush to disk now so the setting survives a hard kill (build), not
|
|
// only a clean quit. Settings changes are rare user actions, so the
|
|
// extra write is negligible.
|
|
PlayerPrefs.Save();
|
|
}
|
|
}
|
|
}
|