Destroy pre-match objects on seek and block hunter wall-climb while hiding

Destroy every GameObject tagged "PreMatch" locally when the match enters
the Seek sub-phase (hooked in ApplyPhaseLocal, runs on every machine; the
objects are plain scene geometry with no NetworkObject, so each client
cleans up its own copies). Block hunters from starting a wall- or
ceiling-climb during the Hide sub-phase via a WallClimbBlockedNow() gate
in UpdateWallClimbState; an in-progress climb is exited cleanly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-30 20:05:09 +02:00
1 parent 6fcada4631
commit c29cd172bf
2 files changed
+31 -2

No files matched your search

+12 -1
View File
@@ -226,6 +226,7 @@ public class PlayerCharacterController : MonoBehaviour
private const float RunningSpeedThresholdSqr = 0.04f; // (0.2 m/s)^2
private CharacterController _controller;
private NetworkPlayerSetup _setup; // sibling role source; null on non-networked test instances
private float _verticalVelocity;
private Vector3 _horizontalVelocity; // smoothed horizontal move velocity (accel/decel ramp)
private bool _sprinting; // sprint key state this frame (exposed via IsSprinting)
@@ -282,6 +283,7 @@ public class PlayerCharacterController : MonoBehaviour
void Awake()
{
_controller = GetComponent<CharacterController>();
_setup = GetComponent<NetworkPlayerSetup>();
BaseCapsuleCenterY = _controller.center.y;
BaseCapsuleRadius = _controller.radius;
BaseCapsuleHeight = _controller.height;
@@ -520,12 +522,21 @@ public class PlayerCharacterController : MonoBehaviour
/// (not on mere contact). Leaving while climbing is handled in
/// <see cref="ApplyWallClimbMovement"/>.
/// </summary>
// Hunters may not grab a wall during the hide phase (they wait it out); every other role/phase climbs
// normally. The controller only runs for the local owner, so _setup is this avatar's own role.
private bool WallClimbBlockedNow()
{
var match = MatchManager.Instance;
return match && match.LocalSubPhase == MatchManager.MatchSubPhase.Hide
&& _setup && _setup.Role == PlayerRole.Hunter;
}
private void UpdateWallClimbState(Vector3 moveDir)
{
if (_reentryCooldown > 0f)
_reentryCooldown -= Time.deltaTime;
if (!enableWallClimb)
if (!enableWallClimb || WallClimbBlockedNow())
{
if (_isWallClimbing)
ExitWallClimb();