implemented NPC system and working bartender conversation
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using StarterAssets;
|
||||
using UnityEngine;
|
||||
using Yarn.Unity;
|
||||
|
||||
@@ -13,7 +12,6 @@ namespace NightclubArcadia.Dialogue
|
||||
{
|
||||
[SerializeField] private DialogueRunner dialogueRunner;
|
||||
[SerializeField] private GameObject dialogueUI;
|
||||
[SerializeField] private GameObject playerArmature;
|
||||
[SerializeField] private string yarnNodeName = "Bartender_Chat";
|
||||
|
||||
private bool playerInRange = false;
|
||||
@@ -38,14 +36,19 @@ namespace NightclubArcadia.Dialogue
|
||||
}
|
||||
}
|
||||
|
||||
void StartConversation()
|
||||
async void StartConversation()
|
||||
{
|
||||
var playerController = playerArmature.GetComponent<ThirdPersonController>();
|
||||
if (playerController != null)
|
||||
playerController.enabled = false;
|
||||
// Player controls are locked by DialogueTransitionController off the
|
||||
// runner's onDialogueStart event — nothing to do for that here.
|
||||
if (DialogueUIVisibility.Show(dialogueUI))
|
||||
{
|
||||
// Only reached if the UI was found deactivated; give TMP a
|
||||
// frame to re-cache its Canvas in OnEnable before any text is
|
||||
// generated.
|
||||
await Awaitable.NextFrameAsync();
|
||||
}
|
||||
|
||||
dialogueUI.SetActive(true);
|
||||
dialogueRunner.StartDialogue(yarnNodeName);
|
||||
await dialogueRunner.StartDialogue(yarnNodeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user