예제 #1
0
 public void Click()
 {
     if ((sceneScript.currentText == sceneScript.texts.Count - 1) && !sceneScript.choose)
     {
         GameObject destroyed = Instantiate(Gamecontroller.instance.currentScene);
         Gamecontroller.instance.currentScene = sceneToLoad;
         Instantiate(sceneToLoad, Gamecontroller.instance.game.transform);
         Destroy(Gamecontroller.instance.game.transform.GetChild(0).gameObject);
         Destroy(destroyed);
     }
     if (sceneScript.currentText >= sceneScript.texts.Count)
     {
         print("texto fuera de rango");
         return;
     }
     if (sceneScript.texts[sceneScript.currentText].gameObject.GetComponent <TextManagerScript>().state == TextState.ended)
     {
         if (sceneScript.state == State.Chosing)
         {
             if (sceneToLoad == null)
             {
                 return;
             }
             GameObject destroyed = Instantiate(Gamecontroller.instance.currentScene);
             Gamecontroller.instance.currentScene = sceneToLoad;
             Instantiate(sceneToLoad, Gamecontroller.instance.prefabScene);
             Destroy(Gamecontroller.instance.game.transform.GetChild(0).gameObject);
             Destroy(destroyed);
         }
         else if (sceneScript.state == State.Texting)
         {
             sceneScript.NextText();
         }
     }
     else if (sceneScript.texts[sceneScript.currentText].gameObject.GetComponent <TextManagerScript>().state == TextState.paused)
     {
         sceneScript.texts[sceneScript.currentText].gameObject.GetComponent <TextManagerScript>().state = TextState.typing;
     }
     else if (sceneScript.texts[sceneScript.currentText].gameObject.GetComponent <TextManagerScript>().state == TextState.typing)
     {
         sceneScript.texts[sceneScript.currentText].gameObject.GetComponent <TextManagerScript>().state = TextState.skipping;
         sceneScript.texts[sceneScript.currentText].gameObject.GetComponent <TextManagerScript>().Skip();
     }
 }