The player character movement is disabled during dialogue
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user