Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TestDialog : MonoBehaviour {
- DialogSystem dialog;
- // Use this for initialization
- void Start () {
- dialog = DialogSystem.instance;
- }
- public string[] s = new string[]
- {
- "vi tester:Hele gruppen",
- "gdsfgdfhm",
- "smodlhdt"
- };
- int index = 0;
- // Update is called once per frame
- void Update () {
- if (Input.GetKeyDown(KeyCode.Space))
- {
- if(!dialog.isSpeaking || dialog.isWaitingForUserInput)
- {
- if(index >=s.Length)
- {
- return;
- }
- Say(s[index]);
- index++;
- }
- }
- }
- void Say (string s)
- {
- string[] parts = s.Split(':');
- string speech = parts[0];
- string speaker = (parts.Length >= 2) ? parts[1] : "";
- dialog.Say(speech, speaker);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement