Beispiel #1
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);
            }
        };
    }
Beispiel #2
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++;
            }
        }
    }
Beispiel #3
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);
            }
        };
    }
Beispiel #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];
    }
Beispiel #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);
    }
Beispiel #7
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);
            }
        }
    }
Beispiel #8
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);
            }
        };
    }
Beispiel #9
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];
     }
 }
Beispiel #10
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);
         }
     });
 }
Beispiel #11
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();
     }
 }
Beispiel #12
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);
                    }
                }
            };
        }
    }