Refactor Assets/Scripts: trim restating comments, minor structure cleanups
Sweep over 48 files (Editor/ excluded): remove comments that restate the code, condense class summaries, fix three stale doc statements (HsvColorPicker alpha bar, PaintHud layoutPrefab, MasterVolume FallbackDefault). Inline two single-use wrappers (IsPointerOverUi, BuildModes), drop an unused using, replace a magic literal with the existing ParallaxBase constant, and convert ~10 UnityEngine.Object null checks to the implicit-bool convention. No serialized fields, signatures, RPC/NetworkVariable names, defaults, or #if blocks touched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eeee5fc2f0
commit
6c03e5d3f6
48 files changed
+289
-481
No files matched your search
@@ -3,16 +3,10 @@ using Unity.Cinemachine;
|
||||
using Chameleon.Components;
|
||||
|
||||
/// <summary>
|
||||
/// First-person camera. Drives its OWN dedicated <see cref="CinemachineCamera"/>: each frame it snaps
|
||||
/// to the player's dedicated <c>FirstPersonTarget</c> (the eye anchor) for position and
|
||||
/// applies free mouse-look (yaw/pitch) for rotation. While active the player's mesh is hidden so the
|
||||
/// body isn't seen from the inside. Movement stays with the player controller, which reads the
|
||||
/// brain-driven Main Camera forward, so WASD is automatically relative to this view.
|
||||
///
|
||||
/// Activation is driven by <see cref="FirstPersonMode"/> via <see cref="SetActive"/>: it raises the
|
||||
/// vcam priority so the CinemachineBrain blends to it, snaps look to the current view (no jump), hides
|
||||
/// the mesh and locks the cursor. While inactive the vcam rests at a low priority and this component
|
||||
/// does nothing.
|
||||
/// First-person camera on its own dedicated <see cref="CinemachineCamera"/>: snaps to the player's eye
|
||||
/// anchor, applies free mouse-look, and hides the player mesh while active. Driven by
|
||||
/// <see cref="FirstPersonMode"/> via <see cref="SetActive"/>; WASD stays view-relative automatically
|
||||
/// because movement reads the brain-driven Main Camera forward.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(CinemachineCamera))]
|
||||
[DisallowMultipleComponent]
|
||||
|
||||
@@ -5,14 +5,10 @@ using UnityEngine.InputSystem;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Free-flying spectator camera. Drives its OWN dedicated <see cref="CinemachineCamera"/> by moving
|
||||
/// this transform with WASD (relative to where it looks), Q/E (or Space/Left Ctrl) for down/up
|
||||
/// and the mouse for look. Collision is a <see cref="CharacterController"/> capsule sized like the
|
||||
/// player's, so the freecam slides along world geometry instead of clipping through walls/floors.
|
||||
///
|
||||
/// Activation is driven by <see cref="FreeCamMode"/> via <see cref="SetActive"/>: it raises the vcam
|
||||
/// priority so the CinemachineBrain blends to it, snaps the rig to the current view (no jump) and
|
||||
/// locks the cursor. While inactive the vcam rests at a low priority and this component does nothing.
|
||||
/// Free-flying spectator camera on its own dedicated <see cref="CinemachineCamera"/>: WASD flight relative
|
||||
/// to the view, Q/E (or Space/Left Ctrl) for down/up, mouse look. A <see cref="CharacterController"/>
|
||||
/// capsule makes it slide along world geometry instead of clipping. Driven by <see cref="FreeCamMode"/>
|
||||
/// via <see cref="SetActive"/>; while inactive this component does nothing.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
[DisallowMultipleComponent]
|
||||
@@ -194,5 +190,4 @@ public class FreeCamController : MonoBehaviour
|
||||
return Input.GetKey(KeyCode.LeftShift);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,16 +8,10 @@ using UnityEngine.InputSystem;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Holds a list of <see cref="PlayerPose"/>s plus the active index. The pose system owns ALL character
|
||||
/// animation (the Animator is left empty): standing / airborne / wall / ceiling holds the active pose's
|
||||
/// idle clip, walking/sprinting on the ground plays its optional walk/run clip (unset = idle held).
|
||||
///
|
||||
/// One key cycles poses (wrapping); sprinting in any state snaps back to the default pose, held
|
||||
/// continuously so the reset shows up immediately. Clips play through a tiny <see cref="PlayableGraph"/>
|
||||
/// (two-input mixer on an <see cref="AnimationPlayableOutput"/>) that crossfades every clip switch over
|
||||
/// <see cref="poseBlendDuration"/>. Each pose also carries its own CharacterController capsule (eased,
|
||||
/// so a low pose can crawl under furniture) and per-pose camera y-offsets (third-person framing and
|
||||
/// first-person eye).
|
||||
/// Owns ALL character animation (the Animator is left empty): plays the active <see cref="PlayerPose"/>'s
|
||||
/// idle or optional walk/run/fall clip through a two-input mixer <see cref="PlayableGraph"/> that
|
||||
/// crossfades every clip switch. One key cycles poses, sprinting resets to the default pose; each pose
|
||||
/// also carries its own eased CharacterController capsule and per-pose camera y-offsets.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(PlayerCharacterController))]
|
||||
[DisallowMultipleComponent]
|
||||
@@ -115,10 +109,9 @@ public class PlayerPoseController : MonoBehaviour
|
||||
private Quaternion[] _restRot;
|
||||
private Vector3[] _restScale;
|
||||
|
||||
/// <summary>Index of the currently selected pose.</summary>
|
||||
public int CurrentIndex => _currentIndex;
|
||||
|
||||
/// <summary>Locomotion category resolved this frame (which clip the active pose is playing). The owner publishes it for network sync.</summary>
|
||||
/// <summary>Locomotion category resolved this frame; the owner publishes it for network sync.</summary>
|
||||
public Locomotion CurrentLocomotion => _currentLocomotion;
|
||||
|
||||
/// <summary>
|
||||
@@ -219,7 +212,6 @@ public class PlayerPoseController : MonoBehaviour
|
||||
_firstPersonCameraOffset = EaseCameraOffset(_firstPersonCameraOffset, firstPersonTarget);
|
||||
}
|
||||
|
||||
/// <summary>Eases a camera y-offset toward its target at <see cref="cameraOffsetSpeed"/>; 0 snaps.</summary>
|
||||
private float EaseCameraOffset(float current, float target)
|
||||
{
|
||||
return cameraOffsetSpeed > 0f
|
||||
@@ -261,7 +253,6 @@ public class PlayerPoseController : MonoBehaviour
|
||||
return poses[Mathf.Clamp(_currentIndex, 0, poses.Count - 1)];
|
||||
}
|
||||
|
||||
/// <summary>Maps the controller's current movement state to a locomotion category for clip selection.</summary>
|
||||
private Locomotion ResolveLocalLocomotion()
|
||||
{
|
||||
if (_player.IsMovingOnGround)
|
||||
@@ -375,7 +366,6 @@ public class PlayerPoseController : MonoBehaviour
|
||||
_posePlaying = true;
|
||||
}
|
||||
|
||||
/// <summary>Builds the graph (a 2-input mixer feeding the Animator output) lazily if it isn't alive yet.</summary>
|
||||
private void EnsureGraph()
|
||||
{
|
||||
if (_graph.IsValid())
|
||||
@@ -426,7 +416,6 @@ public class PlayerPoseController : MonoBehaviour
|
||||
ApplyBlendWeights();
|
||||
}
|
||||
|
||||
/// <summary>Advances an in-flight crossfade and drops the outgoing pose once it has fully faded.</summary>
|
||||
private void AdvanceBlend(float dt)
|
||||
{
|
||||
if (!_blending)
|
||||
@@ -446,7 +435,6 @@ public class PlayerPoseController : MonoBehaviour
|
||||
ApplyBlendWeights();
|
||||
}
|
||||
|
||||
/// <summary>Pushes the current blend onto the mixer inputs (smoothstepped while a "from" pose exists).</summary>
|
||||
private void ApplyBlendWeights()
|
||||
{
|
||||
if (!_mixer.IsValid())
|
||||
|
||||
@@ -2,10 +2,9 @@ using UnityEngine;
|
||||
using Unity.Cinemachine;
|
||||
|
||||
/// <summary>
|
||||
/// Feeds mouse input into a <see cref="CinemachineOrbitalFollow"/> so the camera
|
||||
/// orbits the follow target. Mouse movement drives yaw/pitch, the wheel zooms.
|
||||
/// The orbit behaviour depends on <see cref="LookMode"/> (usually set by the
|
||||
/// GameModeManager). Attach to the camera rig (the CinemachineOrbitalFollow).
|
||||
/// Feeds mouse input into a <see cref="CinemachineOrbitalFollow"/>: mouse movement drives yaw/pitch,
|
||||
/// the wheel zooms, middle-mouse pans (paint mode only). Orbit behaviour depends on
|
||||
/// <see cref="LookMode"/> (usually set by the GameModeManager). Attach to the camera rig.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(CinemachineOrbitalFollow))]
|
||||
[DisallowMultipleComponent]
|
||||
@@ -346,5 +345,4 @@ public class ThirdPersonOrbitInput : MonoBehaviour
|
||||
// Offset is camera-local (x=right, y=up); the extension translates eye + look-at together -> true pan.
|
||||
_camOffset.Offset = new Vector3(_pan.x, _pan.y, 0f);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user