1 using System.Collections;
2 using System.Collections.Generic;
6 public class BossDialogue : MonoBehaviour
8 public GameObject continueButton;
9 public GameObject dialogueBox;
10 public GameObject SpeechBubble;
11 public GameObject mouse;
13 BossSpeechBubble speechBubble;
15 public Text dialogueText;
18 GameObject bossObject;
22 public string[] sentences;
27 public float typingSpeed;
31 dialogueBox.SetActive(false);
32 continueButton.SetActive(false);
33 //SpeechBubble.SetActive(false);
34 speechBubble = SpeechBubble.GetComponent<BossSpeechBubble>();
35 boss = bossObject.GetComponent<Boss>();
40 if (dialogueText.text == sentences[index])
42 continueButton.SetActive(true);
46 public IEnumerator Type()
48 dialogueBox.SetActive(true);
49 SpeechBubble.SetActive(true);
50 speechBubble.NextSpeaker();
51 foreach (char letter in sentences[index].ToCharArray())
53 dialogueText.text += letter;
54 yield return new WaitForSeconds(typingSpeed);
58 public void NextSentence()
60 FindObjectOfType<AudioManager>().Play("click");
61 continueButton.SetActive(false);
63 if (index < sentences.Length - 1)
66 dialogueText.text = "";
67 StartCoroutine(Type());
68 speechBubble.NextSpeaker();
72 dialogueText.text = "";
73 dialogueBox.SetActive(false);
74 SpeechBubble.SetActive(false);
75 boss.bossfight = true;
76 bossObject.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
77 mouse.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
78 mouse.GetComponent<MouseController>().enabled = true;
79 FindObjectOfType<AudioManager>().Play("snail_fight");