Question by 
               Alvaro95 · May 31, 2019 at 10:24 PM · 
                c#script.scripting beginnercountervideotexture  
              
 
              Having transitions between two VideoPlayers triggered by clicking "x" times in a text layer
Well, first of all I am a completely newcomer. I am doing a visual novel like videogame. I have text that when you click it it transition to another like this:
 public class DialogoUno : MonoBehaviour
 {
     DialogueSystem dialogue;
 
 
     void Start()
     {
         dialogue = DialogueSystem.instance;
     }
 
     public string[] s = new string[]
     {
         "Que dolor de cabeza...:¿?",
         "¿Y esta voz?",
         "...",
         "¿Quién soy?",
         "...",
         "¿Por qué no consigo recordar nada?",
         "...",
         "¿Qué querrá decir esto?",
         "Debería ir... quizá la persona de la nota pueda ayudarme...",
     };
 
     int index = 0;
     // Update is called once per frame
     void Update()
     {
         if (Input.GetMouseButtonDown(0))
         {
             if (!dialogue.isSpeaking || dialogue.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 >= 9) ? parts[1] : "";
 
         dialogue.Say(speech, speaker);
     }
 }
Using this other code to make the transition stuff:
     public ELEMENTS elements;
 
     void Awake()
     {
         instance = this;
     }
 
     // Use this for initialization
     void Start () 
     {
         
     }
 
     /// <summary>
     /// Say something and show it on the speech box.
     /// </summary>
     public void Say(string speech, string speaker = "")
     {
         StopSpeaking();
 
         speaking = StartCoroutine(Speaking(speech, false, speaker));
     }
 
     /// <summary>
     /// Say something to be added to what is already on the speech box.
     /// </summary>
     public void SayAdd(string speech, string speaker = "")
     {
         StopSpeaking();
 
         speechText.text = targetSpeech;
 
         speaking = StartCoroutine(Speaking(speech, true, speaker));
     }
 
     public void StopSpeaking()
     {
         if (isSpeaking)
         {
             StopCoroutine(speaking);
         }
         speaking = null;
     }
         
     public bool isSpeaking {get{return speaking != null;}}
     [HideInInspector] public bool isWaitingForUserInput = false;
 
     public string targetSpeech = "";
     Coroutine speaking = null;
     IEnumerator Speaking(string speech, bool additive, string speaker = "")
     {
         speechPanel.SetActive(true);
         targetSpeech = speech;
 
         if (!additive)
             speechText.text = "";
         else
             targetSpeech = speechText.text + targetSpeech;
 
         speakerNameText.text = DetermineSpeaker(speaker);//temporary
 
         isWaitingForUserInput = false;
 
         while(speechText.text != targetSpeech)
         {
             speechText.text += targetSpeech[speechText.text.Length];
             yield return new WaitForEndOfFrame();
         }
 
         //text finished
         isWaitingForUserInput = true;
         while(isWaitingForUserInput)
             yield return new WaitForEndOfFrame();
 
         StopSpeaking();
     }
 
     string DetermineSpeaker(string s)
     {
         string retVal = speakerNameText.text;//default return is the current name
         if (s != speakerNameText.text && s != "")
             retVal = (s.ToLower().Contains("narrator")) ? "" : s;
 
         return retVal;
     }
 
     [System.Serializable]
     public class ELEMENTS
     {
         /// <summary>
         /// The main panel containing all dialogue related elements on the UI
         /// </summary>
         public GameObject speechPanel;
         public Text speakerNameText;
         public Text speechText;
     }
     public GameObject speechPanel {get{return elements.speechPanel;}}
     public Text speakerNameText {get{return elements.speakerNameText;}}
     public Text speechText {get{return elements.speechText;}}
 }
The videoplayer has this code:
     void Start()
     {
         StartCoroutine(PlayVideo());
     }
     IEnumerator PlayVideo()
     {
         videoPlayer.Prepare();
         WaitForSeconds waitForSeconds = new WaitForSeconds(1);
         while (!videoPlayer.isPrepared)
         {
             yield return waitForSeconds;
             break;
         }
 
         
         rawImage.texture = videoPlayer.texture;
         videoPlayer.Play();
         audioSource.Play();
     }
 
     
 }
(All of this code is not writting by me, I used tutorials to get it)
So with all of this, how can I play another videoplayer when I click twice (after the '"¿Y esta voz?",' line).
Thanks for all, and sorry if I didn't explain it properly :(
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Image UI not enabling C# SOLVED 1 Answer
how to make a max number on counter. 1 Answer
Possible Infinite Loop Freezing Game 1 Answer
Change button position using script 2 Answers
Set the username with an inputfield ? 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                