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
@@ -2,10 +2,9 @@ using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
|
||||
/// <summary>
|
||||
/// First-person mode. The player keeps walking (WASD, camera-relative) but the camera moves to the
|
||||
/// player's eye (the CameraTarget) with free mouse-look, and the player's mesh is hidden so the body
|
||||
/// isn't seen from the inside. The orbit camera input is disabled while here so it doesn't fight for
|
||||
/// the cursor; the <see cref="FirstPersonController"/> drives its own dedicated CinemachineCamera.
|
||||
/// First-person mode. The player keeps walking, but the camera moves to the eye (CameraTarget) with
|
||||
/// free mouse-look and the player's mesh is hidden. Orbit camera input is disabled so it doesn't fight
|
||||
/// for the cursor; the <see cref="FirstPersonController"/> drives its own dedicated CinemachineCamera.
|
||||
/// </summary>
|
||||
public class FirstPersonMode : GameMode
|
||||
{
|
||||
@@ -13,7 +12,6 @@ public class FirstPersonMode : GameMode
|
||||
|
||||
public override void Enter()
|
||||
{
|
||||
// Player stays fully controllable; only the view changes.
|
||||
SetPlayerControl(true);
|
||||
SetPainting(false);
|
||||
SetOrbitInputEnabled(false);
|
||||
@@ -113,16 +111,16 @@ public class FirstPersonMode : GameMode
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var netObj = _hits[i].collider.GetComponentInParent<NetworkObject>();
|
||||
if (netObj && self && netObj == self) continue; // skip own body
|
||||
if (netObj && self && netObj == self) continue;
|
||||
|
||||
end = _hits[i].point; // first non-self solid hit stops the beam here (wall or avatar)
|
||||
end = _hits[i].point;
|
||||
if (netObj && netObj.IsPlayerObject)
|
||||
{
|
||||
var setup = netObj.GetComponent<NetworkPlayerSetup>();
|
||||
if (setup && setup.Role == PlayerRole.Hider && !setup.IsFound)
|
||||
match.ReportHit(netObj.OwnerClientId);
|
||||
}
|
||||
break; // the first non-self hit decides the shot
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/// <summary>
|
||||
/// Free-fly camera mode. The player is frozen in place, painting is off, and a dedicated
|
||||
/// freecam (<see cref="FreeCamController"/> + its own CinemachineCamera) takes over: fly the
|
||||
/// camera through the map with WASD/Q/E and the mouse, colliding with world geometry like the
|
||||
/// player. The orbit camera input is disabled while here so it doesn't fight for the cursor.
|
||||
/// Free-fly camera mode. The player is frozen and painting is off while a dedicated freecam
|
||||
/// (<see cref="FreeCamController"/> + its own CinemachineCamera) flies through the map, colliding
|
||||
/// with world geometry. Orbit camera input is disabled so it doesn't fight for the cursor.
|
||||
/// </summary>
|
||||
public class FreeCamMode : GameMode
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ public abstract class GameMode
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Toggles painting on the mesh painter.</summary>
|
||||
protected void SetPainting(bool on)
|
||||
{
|
||||
if (Manager.Painter)
|
||||
|
||||
@@ -107,7 +107,7 @@ public class GameModeManager : MonoBehaviour
|
||||
if (!freeCam) freeCam = FindFirstObjectByType<FreeCamController>(FindObjectsInactive.Include);
|
||||
if (!firstPerson) firstPerson = FindFirstObjectByType<FirstPersonController>(FindObjectsInactive.Include);
|
||||
|
||||
BuildModes();
|
||||
BuildModes(null);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@@ -125,8 +125,6 @@ public class GameModeManager : MonoBehaviour
|
||||
/// <summary>Registers the modes for the current context. Without a role (no networked avatar yet,
|
||||
/// or a non-networked scene) the full set is built from whichever rigs are present. With a role the
|
||||
/// set is scoped to that side and ordered so index 0 is its intended start mode. Add new modes here.</summary>
|
||||
private void BuildModes() => BuildModes(null);
|
||||
|
||||
private void BuildModes(PlayerRole? role)
|
||||
{
|
||||
_modes.Clear();
|
||||
@@ -480,7 +478,7 @@ public class GameModeManager : MonoBehaviour
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
{
|
||||
var avatar = avatars[i];
|
||||
if (!avatar || avatar.IsOwner) continue; // skip the local player's own avatar
|
||||
if (!avatar || avatar.IsOwner) continue;
|
||||
var col = avatar.BodyCollider;
|
||||
if (col && col.enabled) Physics.IgnoreCollision(capsule, col, ignore);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user