I’ve a Dialogue system that exhibits up when a scene begins or a participant touches an object. I’m questioning if is it attainable to make the participant freeze/not interactable when dialogue pops up. I do not assume I can use freeze time with Time.timeSacle = 0; since I’m utilizing animation it would freeze the animation and will not play. Is there a workaround this?
That is my Dialogue Supervisor
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
utilizing UnityEngine.UI;
public class DialogueManager : MonoBehaviour
{
public Textual content nameText;
public Textual content dialogueText;
public Animator animator;
non-public Queue<string> sentences;
public static DialogueManager occasion { get; non-public set; }
non-public void Awake()
{
occasion = this;
}
// Begin is known as earlier than the primary body replace
void Begin()
{
dialogueText.textual content = string.Empty;
sentences = new Queue<string>();
}// finish of begin
public void StartDialogue(Dialogue dialogue)
{
animator.SetBool("IsOpen", true);
// Debug.Log("Beginning dialog with " + dialogue.identify);
nameText.textual content = dialogue.identify;
sentences.Clear();
foreach(string sentence in dialogue.sentences)
{
sentences.Enqueue(sentence);
}
DisplayNextSentence();
}
public void DisplayNextSentence()
{
if(sentences.Rely == 0)
{
EndDialogue();
return;
}
string sentence = sentences.Dequeue();
StopAllCoroutines();
StartCoroutine(TypeSentence(sentence));
Debug.Log(sentence);
}// finish of Show subsequent Sentence
IEnumerator TypeSentence (string sentence)
{
float i = 0.07f;
dialogueText.textual content = "";
foreach(char letter in sentence.ToCharArray())
{
dialogueText.textual content += letter;
yield return new WaitForSeconds(i);
}
}
void EndDialogue()
{
animator.SetBool("IsOpen", false);
// Debug.Log("Finish Of Dialog");
}
}
To play the dialogue in a brand new scene I’m simply calling an occasion to Begin dialogue and passing my dialogue in it