Ejemplo n.º 1
0
    public void WriteText()
    {
        if (_UIController.textBox.activeSelf == false)
        {
            _UIController.textBox.SetActive(true);
        }

        if (textWriterSingle != null && textWriterSingle.IsActive())
        {
            textWriterSingle.WriteAllAndDestroy();
        }
        else
        {
            if (textCount >= textArray.Length)
            {
                textLeft = false;
                _UIController.TurnTextOff();
            }
            if (textLeft)
            {
                string message = textArray[textCount];
                textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.05f, true, true);
                textCount++;
            }
        }
    }
Ejemplo n.º 2
0
 public void nextStory()
 {
     if (textWriterSingle != null && textWriterSingle.IsActive())
     {
         textWriterSingle.WriteAllAndDestroy();
         if (currentStory == 5)
         {
             panelTutorial.GetComponent <Animator>().SetBool("open", true);
         }
     }
     else
     {
         if (currentStory < 5)
         {
             currentStory++;
             string message = messageArray[currentStory];
             textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.1f, true, true);
             panel.GetComponent <Image>().sprite = spriteArray[currentStory];
             btnPrev.SetActive(true);
             btnNext.SetActive(true);
         }
         else if (currentStory == 5)
         {
             panelTutorial.GetComponent <Animator>().SetBool("open", true);
         }
     }
 }
    private void Awake()
    {
        messageText        = transform.Find("message").Find("messageText").GetComponent <Text>();
        talkingAudioSource = transform.Find("talkingSound").GetComponent <AudioSource>();

        transform.Find("message").GetComponent <Button_UI>().ClickFunc = () => {
            if (textWriterSingle != null && textWriterSingle.IsActive())
            {
                // Currently active TextWriter
                textWriterSingle.WriteAllAndDestroy();
            }
            else
            {
                string[] messageArray = new string[] {
                    "This is the assistant speaking, hello and goodbye, see you next time!",
                    "Hey there!",
                    "This is a really cool and useful effect",
                    "Let's learn some code and make awesome games!",
                    "Check out Battle Royale Tycoon on Steam!",
                };

                string message = messageArray[Random.Range(0, messageArray.Length)];
                StartTalkingSound();
                textWriterSingle = TextWriter.AddWriter_Static(messageText, message, .02f, true, true, StopTalkingSound);
            }
        };
    }
Ejemplo n.º 4
0
    private void Awake()
    {
        messageText        = transform.Find("message").Find("messageText").GetComponent <Text>();
        talkingAudioSource = transform.Find("talkingSound").GetComponent <AudioSource>();

        transform.Find("message").GetComponent <Button_UI>().ClickFunc = () => {
            if (textWriterSingle != null && textWriterSingle.IsActive())
            {
                // Currently active TextWriter
                textWriterSingle.WriteAllAndDestroy();
            }
            else
            {
                string[] messageArray = new string[] {
                    "Defination",
                    "A regular expression is an algebraic formula whose value is a pattern consisting of a set of strings, called the language of the expression.",
                    "Example:"
                };

                string message = messageArray[Random.Range(0, messageArray.Length)];
                StartTalkingSound();
                textWriterSingle = TextWriter.AddWriter_Static(messageText, message, .17f, true, true, StopTalkingSound);
            }
        };
    }
Ejemplo n.º 5
0
    private void winGame()
    {
        currentStory = 6;
        string message = messageArray[currentStory];

        textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.1f, true, true);
        GetComponent <SoundEffect>().playSound(0, true, 1f);
        panel.GetComponent <Image>().sprite = spriteArray[currentStory];
    }
Ejemplo n.º 6
0
    public void skipStory()
    {
        currentStory = 5;
        string message = messageArray[currentStory];

        textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.1f, true, true);
        panel.GetComponent <Image>().sprite = spriteArray[currentStory];
        btnPrev.SetActive(true);
        btnNext.SetActive(true);
        panelTutorial.GetComponent <Animator>().SetBool("open", true);
    }
Ejemplo n.º 7
0
    private void Setup(IconType iconType, string text)
    {
        textMeshPro.SetText(text);
        textMeshPro.ForceMeshUpdate();
        Vector2 textSize = textMeshPro.GetRenderedValues(false);

        Vector2 padding = new Vector2(7f, 3f);

        backgroundSpriteRenderer.size = textSize + padding;

        Vector3 offset = new Vector3(-3f, 0f);

        backgroundSpriteRenderer.transform.localPosition =
            new Vector3(backgroundSpriteRenderer.size.x / 2f, 0f) + offset;

        iconSpriteRenderer.sprite = GetIconSprite(iconType);

        TextWriter.AddWriter_Static(textMeshPro, text, .03f, true, true, () => { });
    }
Ejemplo n.º 8
0
 private void Start()
 {
     if (sceneName == "Welcome" && StartGame.isTrackingMarker("CylinderTarget"))
     {
         TextWriter.AddWriter_Static(messageText, "Das ist die Insel Österreich. Durch COVID-19 wurde sie von der Außenwelt abgeschnitten. Hilf mit, sodass wir unseren Platz in der Welt wiederfinden! Starte das Spiel!", 0.1f, true, true, StopTalkingSoundAndAnimation);
     }
     if (sceneName == "Level1")
     {
         TextWriter.AddWriter_Static(messageText, "Hallo liebes Österreich schön, dass Sie her gefunden haben! (Berühren Sie die Sprechblase um weiter zu machen)", 0.1f, true, true, StopTalkingSoundAndAnimation);
     }
     if (sceneName == "Level2")
     {
         TextWriter.AddWriter_Static(messageText, "Super du hast es ins Level 2 geschafft", 0.1f, true, true, StopTalkingSoundAndAnimation);
     }
     if (sceneName == "Level3")
     {
         TextWriter.AddWriter_Static(messageText, "Gratuliere, du hast es ins Level 3 geschafft", 0.1f, true, true, StopTalkingSoundAndAnimation);
     }
 }
Ejemplo n.º 9
0
    void Update()
    {
        if (input.Gameplay.Interact.triggered)
        {
            if (textWriterSingle != null && textWriterSingle.IsActive())
            {
                // Currently active TextWriter
                textWriterSingle.WriteAllAndDestroy();
            }
            else
            {
                // Upon pressing interact button, set textbox to active
                textbox.SetActive(true);

                //message = messageArray[Random.Range(0, messageArray.Length)];
                //Debug.Log("messageArray.Length" + messageArray.Length);
                //Debug.Log("BEFORE messageIndex: " + messageIndex);
                //Debug.Log("AFTER messageIndex: " + messageIndex);

                //Set message to a specific position in the array
                message = messageArray[messageIndex];
                // Check if current message is not the last message
                if (messageIndex < (messageArray.Length) - 1)
                {
                    // Increment position in the array to go to the next message
                    messageIndex++;
                    // If the current message is the last, reset message to the first message
                }
                else if (messageIndex == (messageArray.Length) - 1)
                {
                    // Reset the message index
                    messageIndex = 0;
                    // Set textbox to not active after reaching last line
                    textbox.SetActive(false);
                }

                // Note: When sound is needed uncomment this code
                //talkingAudioSource.Play();
                StartTalkingSound();
                textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.025f, true, true, StopTalkingSound);
            }
        }
    }
Ejemplo n.º 10
0
    private void Awake()
    {
        int i = 0; //just added

        messageText = transform.Find("message").Find("messageText").GetComponent <Text>();

        transform.Find("message").GetComponent <Button_UI>().ClickFunc = () =>
        {
            if (textWriterSingle != null && textWriterSingle.IsActive())
            {
                //Currently active text writer
                textWriterSingle.WriteAllAndDestroy();
            }
            else
            {
                string[] messageArray = new string[]
                {
                    "1) Hakuna Matata!",
                    "2) What a wonderful phrase",
                    "3) in a Galaxy far far away",
                    "4) Ain't no passing craze",
                    "5) shrek lives",
                };

                //just added
                if (i < messageArray.Length)
                {
                    string message = messageArray[i];
                    textWriterSingle = TextWriter.AddWriter_Static(messageText, message, .05f, true, true);
                    i++;
                }
                else
                {
                    SceneManager.LoadScene("Character_Selection");
                }

                //this is no longer needed but is left here just because
                //string message = messageArray[Random.Range(0, messageArray.Length)];
                //textWriterSingle = TextWriter.AddWriter_Static(messageText, message, .05f, true, true);
            }
        };
    }
Ejemplo n.º 11
0
    private void Start()
    {
        if (btnStart != null)
        {
            btnStart.SetActive(false);
        }

        if (GameUtility.LangType == Language.Eng)
        {
            textMassage       = engText;
            talkingAudio.clip = enAudio;
        }
        else if (GameUtility.LangType == Language.Indo)
        {
            textMassage       = indoText;
            talkingAudio.clip = indoAudio;
        }
        talkingAudio.mute = GameUtility.mute;
        startTalking();
        TextWriter.AddWriter_Static(massageText, textMassage, timerPerCharacter, true, true, OnComplete);
    }
Ejemplo n.º 12
0
 public void prevStory()
 {
     if (textWriterSingle != null && textWriterSingle.IsActive())
     {
         textWriterSingle.WriteAllAndDestroy();
     }
     else
     {
         btnPrev.SetActive(true);
         btnNext.SetActive(true);
         currentStory--;
         if (currentStory < 0)
         {
             currentStory = 0;
             btnPrev.SetActive(false);
         }
         string message = messageArray[currentStory];
         textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.1f, true, true);
         panel.GetComponent <Image>().sprite = spriteArray[currentStory];
     }
 }
Ejemplo n.º 13
0
 private void Awake()
 {
     messageText = transform.Find("Talker").Find("message").Find("messageText").GetComponent <ArabicText>();
     initailizeString();
     transform.Find("Talker").Find("message").GetComponent <Button>().onClick.AddListener(() => {
         if (textWriterSingle != null && textWriterSingle.isActive())
         {
             //textWriterSingle.WriteAllAndDestroy();
         }
         else if (current_index < messageArray.Length)
         {
             string message = messageArray[current_index];
             playClip();
             textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.1f, true, true, null);
             current_index++;
         }
         else
         {
             SceneManager.LoadScene(sceneIndex);
         }
     });
 }
Ejemplo n.º 14
0
 private void Start()
 {
     sound          = GameObject.FindGameObjectWithTag("Music");
     Cursor.visible = true;
     Cursor.SetCursor(cursor, Vector2.zero, CursorMode.ForceSoftware);
     if (menang != true)
     {
         string message = messageArray[currentStory];
         textWriterSingle = TextWriter.AddWriter_Static(messageText, message, 0.1f, true, true);
         panel.GetComponent <Image>().sprite = spriteArray[currentStory];
         btnPrev.SetActive(false);
     }
     else
     {
         btnPrev.SetActive(false);
         btnNext.SetActive(false);
         btnSkip.SetActive(false);
         winGame();
     }
     if (staticResources.Instance() != null)
     {
         btnSound.GetComponent <Image>().sprite = sound.GetComponent <SoundEffect>().getSprite();
     }
 }
Ejemplo n.º 15
0
 private void Start()
 {
     TextWriter.AddWriter_Static(messageText, introTexts[SceneManager.GetActiveScene().buildIndex], .1f, true);
 }
Ejemplo n.º 16
0
    IEnumerator TutorialCoroutine()
    {
        jumpButton.SetActive(false);
        leftButton.SetActive(false);
        rightButton.SetActive(false);
        GameObject.Find("Player").GetComponent <Rigidbody>().useGravity = false;
        yield return(new WaitForSeconds(1.2f));

        GameObject.Find("Player").GetComponent <Rigidbody>().useGravity = true;
        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "Welcome to the Tutorial!", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "Welcome to the Tutorial".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        TextWriter.AddWriter_Static(messageText, "Tap the Jump Button to Jump.", .05f, true, true);
        talkingSound.Play();
        yield return(new WaitForSeconds(.05f * "Tap the Jump Button to Jump.".Length));

        talkingSound.Stop();
        jumpButton.SetActive(true);
        yield return(new WaitUntil(TutorialMovement.getJumpButtonPressed));

        TutorialMovement.setJumpButtonPressed(false);
        TextWriter.AddWriter_Static(messageText, "Great! Keep tapping jump in midair to fly!", .05f, true, true);
        talkingSound.Play();
        yield return(new WaitForSeconds(.05f * "Great! Keep tapping jump in midair to fly!".Length));

        talkingSound.Stop();
        yield return(new WaitUntil(TutorialMovement.getJumpButtonPressed));

        TutorialMovement.setJumpButtonPressed(false);
        yield return(new WaitUntil(TutorialMovement.getJumpButtonPressed));

        TutorialMovement.setJumpButtonPressed(false);
        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "Amazing! Now try moving left and right!", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "Amazing! Now try moving left and right!".Length));

        talkingSound.Stop();
        rightButton.SetActive(true);
        leftButton.SetActive(true);
        yield return(new WaitUntil(TutorialMovement.getLeftRightButtonsPressed));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "Wow! Pro Tip: You can hold left and right to keep moving", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "Wow!Pro Tip: You can hold left and right to keep moving".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "With these three buttons you have...", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "With these three buttons you have...".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "FULL CONTROL OF THE CUBE.", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "FULL CONTROL OF THE CUBE.".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "Ever since the tubes started coming...", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "Ever since the tubes started coming".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "...all the cubes have been destroyed", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "all the cubes have been destroyed".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "As the last remaining cube...", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "As the last remaining cube".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "SURVIVE AS LONG AS POSSIBLE", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "SURVIVE AS LONG AS POSSIBLE".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "Collect coins to customimze your look", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "Collect coins to customimze your look".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "and compete with friends on the leaderboard", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "and compete with friends on the leaderboard".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "That's really it!", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "That's really it!".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        talkingSound.Play();
        TextWriter.AddWriter_Static(messageText, "Now see for yourself in game!", .05f, true, true);
        yield return(new WaitForSeconds(.05f * "Now see for yourself in game!".Length));

        talkingSound.Stop();
        yield return(new WaitForSeconds(2f));

        GameObject.Find("Panel").GetComponent <Animator>().Play("startCirc");
        yield return(new WaitForSeconds(1f));

        SceneManager.LoadScene("SampleScene");
    }
Ejemplo n.º 17
0
    // Create a temporary reference to the current scene.

    private void Awake()
    {
        Scene currentScene = SceneManager.GetActiveScene();

        // Retrieve the name of this scene.
        sceneName = currentScene.name;

        Debug.Log(currentScene + " => Current Scene Manager");
        Debug.Log(sceneName + " => Current Scene Name");

        if (sceneName == "Welcome")
        {
            messageText        = transform.Find("Message").Find("Text").GetComponent <Text>();
            talkingAudioSource = transform.Find("TalkingSound").GetComponent <AudioSource>();
            talkingAnimation   = transform.Find("Message").GetComponent <Animation>();


            transform.Find("Message").GetComponent <Button_UI>().ClickFunc = () =>
            {
                if (textWriterSingle != null && textWriterSingle.IsActive())
                {
                    //current active textwriter
                    textWriterSingle.WriteAllAndDestroy();
                }
                else
                {
                    StartTalkingSoundAndAnimation();;
                    textWriterSingle = TextWriter.AddWriter_Static(messageText, "Finden Sie den Button und Starten Sie das Spiel!", 0.1f, true, true, StopTalkingSoundAndAnimation);
                }
            };
        }


        if (sceneName == "Level1")
        {
            messageText        = transform.Find("Message").Find("Text").GetComponent <Text>();
            talkingAudioSource = transform.Find("TalkingSound").GetComponent <AudioSource>();
            talkingAnimation   = transform.Find("Message").GetComponent <Animation>();


            transform.Find("Message").GetComponent <Button_UI>().ClickFunc = () =>
            {
                if (textWriterSingle != null && textWriterSingle.IsActive())
                {
                    //current active textwriter
                    textWriterSingle.WriteAllAndDestroy();
                }
                else
                {
                    StartTalkingSoundAndAnimation();;
                    textWriterSingle = TextWriter.AddWriter_Static(messageText, "Finden Sie zuerst das Target um zu starten!", 0.1f, true, true, StopTalkingSoundAndAnimation);
                    if (StartGame.isTrackingMarker("CylinderTarget"))
                    {
                        StartTalkingSoundAndAnimation();;
                        textWriterSingle = TextWriter.AddWriter_Static(messageText, "Gut gemacht! Kicken Sie jetzt, mit Berühren des Bildschirms so viele Bakterien wie möglich weg!", 0.1f, true, true, StopTalkingSoundAndAnimation);
                    }
                }
            };
        }
        //Isabella Horn
        else if (sceneName == "Level2")
        {
            Debug.Log("Ich bin im zweiten Level");
            messageText        = transform.Find("Message").Find("Text").GetComponent <Text>();
            talkingAudioSource = transform.Find("TalkingSound").GetComponent <AudioSource>();
            talkingAnimation   = transform.Find("Message").GetComponent <Animation>();


            transform.Find("Message").GetComponent <Button_UI>().ClickFunc = () =>
            {
                if (textWriterSingle != null && textWriterSingle.IsActive())
                {
                    //current active textwriter
                    textWriterSingle.WriteAllAndDestroy();
                }
                else
                {
                    StartTalkingSoundAndAnimation();
                    textWriterSingle = TextWriter.AddWriter_Static(messageText, "Versuche dich vor den Bakterien in Sicherheit zu bringen", 0.1f, true, true, StopTalkingSoundAndAnimation);
                    if (StartGame.isTrackingMarker("CylinderTarget"))
                    {
                        StartTalkingSoundAndAnimation();;
                        textWriterSingle = TextWriter.AddWriter_Static(messageText, "Finde das Target um  das Spiel zu starten!", 0.1f, true, true, StopTalkingSoundAndAnimation);
                    }
                }
            };
        }

        else if (sceneName == "Level3")
        {
            Debug.Log("Ich bin im dritten Level");
            messageText        = transform.Find("Message").Find("Text").GetComponent <Text>();
            talkingAudioSource = transform.Find("TalkingSound").GetComponent <AudioSource>();
            talkingAnimation   = transform.Find("Message").GetComponent <Animation>();


            transform.Find("Message").GetComponent <Button_UI>().ClickFunc = () =>
            {
                if (textWriterSingle != null && textWriterSingle.IsActive())
                {
                    //current active textwriter
                    textWriterSingle.WriteAllAndDestroy();
                }
                else
                {
                    StartTalkingSoundAndAnimation();
                    textWriterSingle = TextWriter.AddWriter_Static(messageText, "Nimm dich weiterhin in Acht vor den Bakterien aber versuche mit Masken dich zu schützen", 0.1f, true, true, StopTalkingSoundAndAnimation);
                    if (StartGame.isTrackingMarker("CylinderTarget"))
                    {
                        StartTalkingSoundAndAnimation();;
                        textWriterSingle = TextWriter.AddWriter_Static(messageText, "Finde das Target um  das Spiel zu starten!", 0.1f, true, true, StopTalkingSoundAndAnimation);
                    }
                }
            };
        }
    }
Ejemplo n.º 18
0
 // Start is called before the first frame update
 void Start()
 {
     TextWriter.AddWriter_Static(dialogueText, "it's dangerous to go alone! take this.", 0.1f, true);
     TextWriter.AddWriter_Static(dialogueText2, "it's a secret to everybody.", 0.1f, true);
 }