The player character movement is disabled during dialogue

This commit is contained in:
2026-08-15 16:14:02 +02:00
parent 86614f3104
commit be63c21e15
2 changed files with 18 additions and 2 deletions
@@ -1,3 +1,4 @@
using StarterAssets;
using UnityEngine;
using Yarn.Unity;
@@ -13,15 +14,26 @@ namespace NightclubArcadia.Dialogue
[SerializeField] private GameObject dialogueUI;
[SerializeField] private GameObject playerArmature;
private ThirdPersonController playerController;
void Start()
{
playerController = playerArmature.GetComponent<ThirdPersonController>();
// Dialogue is in progress as soon as this controller is active (including
// auto-started nodes), so the player stays locked out until <<enter_environment>>.
// The armature itself stays active/visible — only its controls are disabled.
if (playerController != null)
playerController.enabled = false;
dialogueRunner.AddCommandHandler("enter_environment", EnterEnvironment);
}
void EnterEnvironment()
{
dialogueUI.SetActive(false);
playerArmature.SetActive(true);
if (playerController != null)
playerController.enabled = true;
}
}
}