Fix: cleanup and minor perf improvements
This commit is contained in:
@@ -63,7 +63,7 @@ namespace Unheimlich.Features.Dialogue
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
if (!_manager.IsInDialogue || !_manager.CurrentDialogueUI.AreChoicesVisible())
|
||||
if (!_manager.IsDialogueActive || !_manager.CurrentDialogueUI.AreChoicesVisible())
|
||||
return;
|
||||
|
||||
_raycastTimer += Time.deltaTime;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Unheimlich.Features.Dialogue
|
||||
{
|
||||
|
||||
[Header("State")]
|
||||
public bool IsInDialogue = false;
|
||||
[SerializeField] private bool IsInDialogue = false;
|
||||
|
||||
[Header("Focus Settings")]
|
||||
[SerializeField] private LayerMask _choiceLayer;
|
||||
@@ -65,19 +65,7 @@ namespace Unheimlich.Features.Dialogue
|
||||
if (_focusSystem != null)
|
||||
{
|
||||
_mainCamera = Camera.main;
|
||||
_focusSystem = new DialogueFocusSystem(
|
||||
this,
|
||||
_mainCamera,
|
||||
PlayerController.Instance?.CameraEffects,
|
||||
_choiceLayer,
|
||||
_focusRange,
|
||||
_focusTime,
|
||||
_raycastInterval,
|
||||
_recoveryDuration,
|
||||
_focusRetentionTime,
|
||||
_fallbackShakeIntensity
|
||||
);
|
||||
_focusSystem.OnChoiceMade += (choice) => OnChoiceMade?.Invoke(choice);
|
||||
InitFocusSystem();
|
||||
|
||||
// Also reset dialogue state in case we exited mid-dialogue
|
||||
IsInDialogue = false;
|
||||
@@ -89,7 +77,15 @@ namespace Unheimlich.Features.Dialogue
|
||||
private void Start()
|
||||
{
|
||||
_mainCamera = Camera.main;
|
||||
InitFocusSystem();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates or recreates the DialogueFocusSystem with the current inspector settings.
|
||||
/// Called from Start and OnEnabled (domain-reload-less re-entry).
|
||||
/// </summary>
|
||||
private void InitFocusSystem()
|
||||
{
|
||||
_focusSystem = new DialogueFocusSystem(
|
||||
this,
|
||||
_mainCamera,
|
||||
|
||||
Reference in New Issue
Block a user