wip : Cleaning not uses & integration liminal spaces

This commit is contained in:
2026-05-20 15:50:41 +01:00
parent 1cff87b60b
commit 396ecddf99
807 changed files with 125823 additions and 273654 deletions
@@ -4,7 +4,6 @@ using Unheimlich.Core;
using Unheimlich.Features.Player.Data;
using Unheimlich.Features.Dialogue;
using InputManager = Unheimlich.Core.Input.InputManager;
using OctoCore.Components;
namespace Unheimlich.Features.Player
{
@@ -28,6 +27,11 @@ namespace Unheimlich.Features.Player
private float _baseFov = -1f;
private float _currentFovOffset = 0f;
// External FOV override — when >= 0, UpdateFovKick uses this as the base FOV
// instead of the locally cached snapshot. Set by HouseOfLeavesController each frame.
// Consumed once per frame — caller must re-submit every Update.
private float _externalBaseFov = -1f;
public bool IsAimLocked { get; private set; }
public bool HasActiveLookInput { get; private set; }
public bool IsUsingGamepad { get; private set; }
@@ -53,24 +57,40 @@ namespace Unheimlich.Features.Player
ApplyAimAssistInternal(_pendingAimAssistTarget);
}
// ── FOV Kick ─────────────────────────────────────────────────────────────
// ── FOV Kick ──────────────────────────────────────────────────────────────
private void UpdateFovKick()
{
if (Settings == null || PlayerController.Instance?.PlayerCamera == null) return;
// Capture base FOV once (handles cases where FOV is changed externally before Start).
if (_baseFov < 0f)
_baseFov = PlayerController.Instance.PlayerCamera.fieldOfView;
// Use the external override if submitted this frame, otherwise fall back
// to the locally cached base FOV.
float effectiveBase = _externalBaseFov >= 0f ? _externalBaseFov : _baseFov;
float targetOffset = PlayerController.Instance.IsRunning ? Settings.fovKickAmount : 0f;
_currentFovOffset = Mathf.Lerp(_currentFovOffset, targetOffset, Time.deltaTime * Settings.fovKickSpeed);
if (effectiveBase < 0f)
{
effectiveBase = PlayerController.Instance.PlayerCamera.fieldOfView;
_baseFov = effectiveBase;
}
PlayerController.Instance.PlayerCamera.fieldOfView = _baseFov + _currentFovOffset;
float targetOffset = PlayerController.Instance.IsRunning ? Settings.fovKickAmount : 0f;
_currentFovOffset = Mathf.Lerp(_currentFovOffset, targetOffset, Time.deltaTime * Settings.fovKickSpeed);
PlayerController.Instance.PlayerCamera.fieldOfView = effectiveBase + _currentFovOffset;
// Consume the override — must be re-submitted next frame by the caller.
_externalBaseFov = -1f;
}
/// <summary>
/// Resets the base FOV reference. Call this if the camera FOV is changed intentionally at runtime.
/// Overrides the base FOV used by the sprint kick for this frame.
/// Call every Update from HouseOfLeavesController — consumed automatically after use.
/// Must be called before CameraEffects.Update runs (use Script Execution Order -10).
/// </summary>
public void SetBaseFovOverride(float fov) => _externalBaseFov = fov;
/// <summary>
/// Resets the locally cached base FOV to the camera's current fieldOfView.
/// </summary>
public void ResetBaseFov()
{
@@ -105,7 +125,7 @@ namespace Unheimlich.Features.Player
if (_shakeTimer <= 0f)
{
_shakeTimer = _shakeInterval * amplitude;
_shakeTimer = _shakeInterval * amplitude;
_shakeOriginalPos = PlayerController.Instance.CameraPivot.position;
float x = Random.Range(-1f, 1f) * amplitude;
@@ -132,7 +152,7 @@ namespace Unheimlich.Features.Player
public void ApplyAimAssist(Vector3 targetCenter)
{
_pendingAimAssistTarget = targetCenter;
_hasAimAssistTarget = true;
_hasAimAssistTarget = true;
}
private void ApplyAimAssistInternal(Vector3 targetCenter)
@@ -147,30 +167,27 @@ namespace Unheimlich.Features.Player
IsAimLocked = false;
Vector3 directionToTarget = (targetCenter - PlayerController.Instance.CameraTransform.position).normalized;
float angleError = Vector3.Angle(PlayerController.Instance.CameraTransform.forward, directionToTarget);
float angleError = Vector3.Angle(PlayerController.Instance.CameraTransform.forward, directionToTarget);
if (IsAimLocked || angleError < Settings.aimAssistMaxAngle)
{
Vector3 targetDirection = directionToTarget;
float targetYaw = Mathf.Atan2(targetDirection.x, targetDirection.z) * Mathf.Rad2Deg;
float targetPitch = -Mathf.Asin(targetDirection.y) * Mathf.Rad2Deg;
float targetYaw = Mathf.Atan2(targetDirection.x, targetDirection.z) * Mathf.Rad2Deg;
float targetPitch = -Mathf.Asin(targetDirection.y) * Mathf.Rad2Deg;
float currentYaw = OctoPlayer.Instance.State.Yaw;
float currentPitch = OctoPlayer.Instance.State.Pitch;
float currentYaw = PlayerController.Instance.Movement.Yaw;
float currentPitch = PlayerController.Instance.Movement.Pitch;
float newYaw = Mathf.LerpAngle(currentYaw, targetYaw, Settings.aimAssistStrength * Time.deltaTime);
float newPitch = Mathf.Lerp(currentPitch, targetPitch, Settings.aimAssistStrength * Time.deltaTime);
float newYaw = Mathf.LerpAngle(currentYaw, targetYaw, Settings.aimAssistStrength * Time.deltaTime);
float newPitch = Mathf.Lerp(currentPitch, targetPitch, Settings.aimAssistStrength * Time.deltaTime);
OctoPlayer.Instance.SetYaw(newYaw);
OctoPlayer.Instance.SetPitch(newPitch);
PlayerController.Instance.Movement.Yaw = newYaw;
PlayerController.Instance.Movement.Pitch = newPitch;
}
_hasAimAssistTarget = false;
}
public void LockAim(bool locked)
{
IsAimLocked = locked;
}
public void LockAim(bool locked) => IsAimLocked = locked;
}
}
}