Пример #1
0
    // Use this for initialization

    // Update is called once per frame
    void Update()
    {
        if (deactivated)
        {
            play.disabled = true;
        }
        buycoinstext [0].text = play.money.ToString();
        buycoinstext [1].text = play.coins.ToString();
        yesnomenu.SetActive(!finishedThePrompt);
        slotsmenu.SetActive(!finishedThePrompt);
        if (taskType != 6)
        {
            yesnomenu.SetActive(false);
        }
        if (taskType != 7)
        {
            slotsmenu.SetActive(false);
        }
        if (!finishedThePrompt)
        {
            if (taskType == 6)
            {
                if (Input.GetKeyDown(KeyCode.Z))
                {
                    finishedThePrompt = true;
                    StopAllCoroutines();
                    dialoguetext.text = "";

                    finishedCurrentTask = true;
                }
                if (Input.GetKeyDown(KeyCode.X))
                {
                    selectedOption = 1;
                    StopAllCoroutines();

                    play.WaitToInteract();
                    dialoguetext.text   = "";
                    finishedThePrompt   = true;
                    finishedCurrentTask = true;
                }
                options = new GameObject[yesnomenu.transform.childCount];

                for (int i = 0; i < yesnomenu.transform.childCount; i++)
                {
                    options [i] = yesnomenu.transform.GetChild(i).gameObject;
                }

                cursor.transform.position = options [selectedOption].transform.position;

                cursor.SetActive(true);

                if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    selectedOption++;
                }
                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    selectedOption--;
                }
                if (selectedOption < 0)
                {
                    selectedOption = 0;
                }
                if (selectedOption == options.Length)
                {
                    selectedOption = options.Length - 1;
                }
            }
            if (taskType == 7)
            {
                if (Input.GetKeyDown(KeyCode.Z))
                {
                    finishedThePrompt = true;
                    StopAllCoroutines();
                    dialoguetext.text       = "";
                    finishedCurrentTask     = true;
                    finishedWithTextOverall = true;
                }
                if (Input.GetKeyDown(KeyCode.X))
                {
                    finishedThePrompt = true;
                    Deactivate();
                    StopAllCoroutines();
                    play.WaitToInteract();
                    dialoguetext.text       = "";
                    finishedCurrentTask     = true;
                    finishedWithTextOverall = true;
                    lots.Exit();
                }
                options = new GameObject[slotsmenu.transform.childCount];

                for (int i = 0; i < slotsmenu.transform.childCount; i++)
                {
                    options [i] = slotsmenu.transform.GetChild(i).gameObject;
                }

                cursor.transform.position = options [selectedOption].transform.position;

                cursor.SetActive(true);

                if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    selectedOption++;
                }
                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    selectedOption--;
                }
                if (selectedOption < 0)
                {
                    selectedOption = 0;
                }
                if (selectedOption == options.Length)
                {
                    selectedOption = options.Length - 1;
                }
            }
        }
        else
        {
            cursor.SetActive(false);
        }

        if (textSpeed == 1)
        {
            scrollequation = 1;
        }
        if (textSpeed == 2)
        {
            scrollequation = 0.75f;
        }
        if (textSpeed == 3)
        {
            scrollequation = .5f;
        }
    }