I don’t know what i can write after “if” to stop player movement during dialog referring to another script responsible for it, please help
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class piotrekDialog : MonoBehaviour
{
public TextMeshProUGUI textDisplay;
public string sentences;
private int index;
public float typingSpeed;
public GameObject continueButton;
public playerMovement playerMovementScript;
void Start()
{
StartCoroutine(Type());
}
void Update()
{
if (textDisplay.text == sentences[index])
{
continueButton.SetActive(true);
}
if (textDisplay.text == sentences[index])
playerMovementScript.playerControlsEnabled = false;
else
{
playerMovementScript.playerControlsEnabled = true;
}
if (/* I don't know what to write here*/)
playerMovementScript.playerControlsEnabled = false;
else
{
playerMovementScript.playerControlsEnabled = true;
}
}
IEnumerator Type()
{
foreach (char letter in sentences[index].ToCharArray())
{
textDisplay.text += letter;
yield return new WaitForSeconds(typingSpeed);
}
}
public void NextSentence()
{
continueButton.SetActive(false);
if (index < sentences.Length - 1)
{
index++;
textDisplay.text = "";
StartCoroutine(Type());
}
else
{
textDisplay.text = "";
continueButton.SetActive(false);
}
}
},I don’t know what i can write after “if” to stop player movement during dialog referring to another script responsible for it, please help
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class piotrekDialog : MonoBehaviour
{
public TextMeshProUGUI textDisplay;
public string sentences;
private int index;
public float typingSpeed;
public GameObject continueButton;
public playerMovement playerMovementScript;
void Start()
{
StartCoroutine(Type());
}
void Update()
{
if (textDisplay.text == sentences[index])
{
continueButton.SetActive(true);
}
if (textDisplay.text == sentences[index])
playerMovementScript.playerControlsEnabled = false;
else
{
playerMovementScript.playerControlsEnabled = true;
}
if (/* I don't know what to write here*/)
playerMovementScript.playerControlsEnabled = false;
else
{
playerMovementScript.playerControlsEnabled = true;
}
}
IEnumerator Type()
{
foreach (char letter in sentences[index].ToCharArray())
{
textDisplay.text += letter;
yield return new WaitForSeconds(typingSpeed);
}
}
public void NextSentence()
{
continueButton.SetActive(false);
if (index < sentences.Length - 1)
{
index++;
textDisplay.text = "";
StartCoroutine(Type());
}
else
{
textDisplay.text = "";
continueButton.SetActive(false);
}
}
}