Integration of the octo input system and centralization of player values
This commit is contained in:
@@ -10,14 +10,12 @@ namespace Unheimlich.Managers
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages gaze-based focus detection for dialogue choices using raycasts.
|
||||
/// Handles progressive focus timers, aim assist integration, visual feedback,
|
||||
/// and automatic choice selection when player maintains focus for a duration.
|
||||
/// </summary>
|
||||
public class DialogueFocusSystem
|
||||
{
|
||||
private readonly DialogueManager _manager;
|
||||
private readonly Camera _mainCamera;
|
||||
private readonly PlayerLook _playerLook;
|
||||
private readonly CameraEffects _cameraEffects;
|
||||
|
||||
private ChoiceFocusHandler _currentFocusedHandler;
|
||||
private float _focusTimer = 0f;
|
||||
@@ -38,7 +36,7 @@ namespace Unheimlich.Managers
|
||||
public DialogueFocusSystem(
|
||||
DialogueManager manager,
|
||||
Camera mainCamera,
|
||||
PlayerLook playerLook,
|
||||
CameraEffects cameraEffects,
|
||||
LayerMask choiceLayer,
|
||||
float focusRange,
|
||||
float focusTime,
|
||||
@@ -49,7 +47,7 @@ namespace Unheimlich.Managers
|
||||
{
|
||||
_manager = manager;
|
||||
_mainCamera = mainCamera;
|
||||
_playerLook = playerLook;
|
||||
_cameraEffects = cameraEffects;
|
||||
_choiceLayer = choiceLayer;
|
||||
_focusRange = focusRange;
|
||||
_focusTime = focusTime;
|
||||
@@ -101,8 +99,8 @@ namespace Unheimlich.Managers
|
||||
{
|
||||
hitHandler = hit.collider.GetComponent<ChoiceFocusHandler>();
|
||||
|
||||
if (_playerLook != null && hitHandler != null)
|
||||
_playerLook.ApplyAimAssist(hit.collider.bounds.center);
|
||||
if (_cameraEffects != null && hitHandler != null)
|
||||
_cameraEffects.ApplyAimAssist(hit.collider.bounds.center);
|
||||
}
|
||||
|
||||
if (hitHandler != _currentFocusedHandler)
|
||||
@@ -121,8 +119,8 @@ namespace Unheimlich.Managers
|
||||
_focusTimer = 0f;
|
||||
_retentionTimer = _focusRetentionTime;
|
||||
|
||||
if (_playerLook != null)
|
||||
_playerLook.LockAim(true);
|
||||
if (_cameraEffects != null)
|
||||
_cameraEffects.LockAim(true);
|
||||
|
||||
ApplyUnfocusEffectToOthers(hitHandler);
|
||||
|
||||
@@ -152,11 +150,11 @@ namespace Unheimlich.Managers
|
||||
DialogueAnimationSettings currentSettings = _manager.CurrentAnimationSettings;
|
||||
bool shouldShake = currentSettings == null || currentSettings.EnableCameraShakeOnFocus;
|
||||
|
||||
if (shouldShake && _playerLook != null)
|
||||
if (shouldShake && _cameraEffects != null)
|
||||
{
|
||||
float shakeIntensity = currentSettings != null ? currentSettings.CameraShakeIntensity : _fallbackShakeIntensity;
|
||||
float shakeSmoothness = currentSettings != null ? currentSettings.CameraShakeSmoothness : 10f;
|
||||
_playerLook.Shake(progress / shakeIntensity, shakeSmoothness);
|
||||
_cameraEffects.ShakeCamera(progress / shakeIntensity, shakeSmoothness);
|
||||
}
|
||||
|
||||
if (_focusTimer >= _focusTime)
|
||||
@@ -183,8 +181,8 @@ namespace Unheimlich.Managers
|
||||
|
||||
selectedHandler.ResetFeedback(_recoveryDuration);
|
||||
|
||||
if (_playerLook != null)
|
||||
_playerLook.LockAim(false);
|
||||
if (_cameraEffects != null)
|
||||
_cameraEffects.LockAim(false);
|
||||
}
|
||||
}
|
||||
else if (_currentFocusedHandler != null && _retentionTimer <= 0f)
|
||||
@@ -202,8 +200,8 @@ namespace Unheimlich.Managers
|
||||
|
||||
ResetAnimationTimers();
|
||||
|
||||
if (_playerLook != null)
|
||||
_playerLook.LockAim(false);
|
||||
if (_cameraEffects != null)
|
||||
_cameraEffects.LockAim(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user