suppress world interaction while a menu panel is open
DialogueInteractable, DialogueTransitionController, and DialogueUIVisibility are reworked against the new UI layer: visibility is driven by UIStateController rather than each component toggling canvases itself, which removes the duplicated show/hide logic the two had accumulated. NPCStandIn now ignores the interact button while UIStateController reports a menu open, so pressing interact through an open panel no longer starts a conversation behind it. The yarnproject change is graph-editor node positions only. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace NightclubArcadia.Dialogue
|
||||
@@ -14,25 +15,39 @@ namespace NightclubArcadia.Dialogue
|
||||
[SerializeField] private GameObject dialogueUI;
|
||||
[SerializeField] private string yarnNodeName = "Bartender_Chat";
|
||||
|
||||
private bool playerInRange = false;
|
||||
private bool playerInRange;
|
||||
private InputAction interactAction;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
interactAction = new InputAction("Interact");
|
||||
interactAction.AddBinding("<Keyboard>/e");
|
||||
interactAction.AddBinding("<Gamepad>/buttonNorth");
|
||||
interactAction.performed += _ =>
|
||||
{
|
||||
if (playerInRange)
|
||||
{
|
||||
StartConversation();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void OnEnable() => interactAction?.Enable();
|
||||
void OnDisable() => interactAction?.Disable();
|
||||
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
playerInRange = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
playerInRange = false;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (playerInRange && Input.GetKeyDown(KeyCode.E))
|
||||
{
|
||||
StartConversation();
|
||||
playerInRange = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user