// Update is called once per frame
    void Update()
    {
        switch (currentTypingState)
        {
        case TypingState.Idle:     //if it needs to be idle

            break;

        case TypingState.Setup:     //setup the line that needs to be displayed
            //call whatever function that will give us the right line to be displayed
            //call to get the stop index
            //call to get the delete index
            setCurrentState(TypingState.Typing);     //move on to typing
            break;

        case TypingState.Typing:     //when the text needs to be displayed letter by letter
            if (currentLetterIndex < currentLine.Length && getStateElapsed() > waitTime)
            {
                if (currentStop < stopIndex.Length && currentLetterIndex == stopIndex[currentStop])
                {
                    waitTime     = 0.01f;
                    currentStop += 1;
                    setCurrentState(TypingState.Stop);
                    break;
                }
                else if (currentLineBreak < lineBreakIndex.Length && currentLetterIndex == lineBreakIndex[currentLineBreak])
                {
                    currentLineBreak += 1;
                    UI_Text.text     += "\n";
                }
                UI_Text.text       += currentLine[currentLetterIndex];
                currentLetterIndex += 1;
                waitTime           += 0.01f;
            }

            if (currentLetterIndex == currentLine.Length - 1)
            {
                waitTime      = 0.01f;
                UI_Text.text += currentLine[currentLetterIndex];
                UI_Text.text += "\n";
                setCurrentState(TypingState.PlayerTyping);
                blinkerTimer = Time.time;
            }


            break;

        case TypingState.PlayerTyping:

            if (Time.time - blinkerTimer > 2)
            {
                blinker.SetActive(true);
            }
            else
            {
                blinker.SetActive(false);
            }
            if (currentLength == 0)
            {
                blinker.SetActive(true);
            }
            else
            {
                blinker.SetActive(false);
            }
            if (currentLength < maxLength)
            {
                if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.LeftShift))    //if the player presses shift, it should be upper case
                {
                    for (int i = 0; i < possibleUC.Length; i++)
                    {
                        if (Input.GetKeyDown(possibleLC[i]))     //check if the player is pressing that specific key
                        {
                            AIDE_Name     += possibleUC[i];
                            UI_Text.text  += possibleUC[i]; // add the character associated to the key that was pressed to the end of the word
                            currentLength += 1;
                            break;                          //break out of the for loop
                        }
                    }
                }
                else     //otherwise these should be lowercase letters.
                {
                    for (int i = 0; i < possibleLC.Length; i++)
                    {
                        if (Input.GetKeyDown(possibleLC[i]))          //check if the player is pressing that specific key
                        {
                            if (possibleLC[i].Trim().Equals("space")) //checks if the player pressed the space button
                            {
                                AIDE_Name     += " ";
                                UI_Text.text  += " ";    //add a space to the current word
                                currentLength += 1;
                                break;
                            }
                            else     //if the key pressed is not space
                            {
                                AIDE_Name     += possibleLC[i];
                                UI_Text.text  += possibleLC[i]; // add the character associated to the key that was pressed to the end of the word
                                currentLength += 1;
                                break;                          //break out of the for loop
                            }
                        }
                    }
                }
            }
            if (currentLength > 0)
            {
                if (Input.GetKeyDown(KeyCode.Backspace))
                {
                    AIDE_Name      = AIDE_Name.Substring(0, AIDE_Name.Length - 1);
                    UI_Text.text   = UI_Text.text.Substring(0, UI_Text.text.Length - 1);
                    currentLength -= 1;
                }
            }
            if (Input.GetKeyDown(KeyCode.Return) && currentLength > 0)
            {
                NAME.SetPlayerName(AIDE_Name);
                SceneManager.LoadScene(1);
            }
            break;

        case TypingState.Reset:      //Once dialogue is no longer displayed and needs to be reset
            currentLetterIndex = 0;  //set letter index to 0
            currentLine        = ""; //reset the current line being displayed
            setCurrentState(TypingState.Idle);
            break;

        case TypingState.Stop:     //if there needs to be a pause in the display of the text
            if (getStateElapsed() > 3f)
            {
                setCurrentState(TypingState.Typing);
            }
            break;
        }
    }