Ejemplo n.º 1
0
    /// <summary>
    /// This coroutine makes the chatbot UI window scroll down.
    /// </summary>
    /// <param name="direction">direction in which object will scroll. 0 for Down, 1 for Up</param>
    private IEnumerator ScrollAnimation(int direction)
    {
        RectTransform chatbotRectTransform = ChatbotUI.GetComponent <RectTransform>();

        //print("scroll animation, direction is : " + direction + " chatbotrect values : " + chatbotRectTransform.offsetMax + ", " + chatbotRectTransform.offsetMin);
        //
        if (direction == 0)
        {
            while (chatbotRectTransform.offsetMax.y > -175f)
            {
                yield return(new WaitForSeconds(0.01f));

                chatbotRectTransform.offsetMax = new Vector2(chatbotRectTransform.offsetMax.x, chatbotRectTransform.offsetMax.y - 10f);
            }
            // activate input field and set focus after animation
            ActivateInputField();
        }
        else if (direction == 1)
        {
            while (chatbotRectTransform.offsetMax.y < 675)
            {
                yield return(new WaitForSeconds(0.01f));

                chatbotRectTransform.offsetMax = new Vector2(chatbotRectTransform.offsetMax.x, chatbotRectTransform.offsetMax.y + 10f);
            }
            // clear previous messages, hide chatbot UI after animation and activate pokemon selection wheel gameobjects
            ClearChabotUIMessages();
            ChatbotUI.SetActive(false);
            selectionWheel.ReactivateSelectionWheelGameObjects();
        }
    }