Ejemplo n.º 1
0
    private void UpdateConversing()
    {
        // Change the cursor's location with < and >
        if (keyDown.Equals(KeyCode.Comma) || keyDown.Equals(KeyCode.W))
        {
            cursorLocation--;
            if (cursorLocation < 0)
            {
                cursorLocation = dialogueManager.buttons.Length - 1;
            }

            if (dialogueManager.buttons[cursorLocation].gameObject.activeSelf)
            {
                cursorLocation = dialogueManager.ChangeCursorLocations(cursorLocation);
            }
            else
            {
                while (!dialogueManager.buttons[cursorLocation].gameObject.activeSelf)
                {
                    cursorLocation--;
                    if (cursorLocation < 0)
                    {
                        cursorLocation = dialogueManager.buttons.Length - 1;
                    }
                }

                cursorLocation = dialogueManager.ChangeCursorLocations(cursorLocation);
            }
        }

        if (keyDown.Equals(KeyCode.Period) || keyDown.Equals(KeyCode.S))
        {
            cursorLocation++;
            if (cursorLocation > dialogueManager.buttons.Length - 1)
            {
                cursorLocation = 0;
            }

            if (dialogueManager.buttons[cursorLocation].gameObject.activeSelf)
            {
                cursorLocation = dialogueManager.ChangeCursorLocations(cursorLocation);
            }
            else
            {
                while (!dialogueManager.buttons[cursorLocation].gameObject.activeSelf)
                {
                    cursorLocation++;
                    if (cursorLocation > dialogueManager.buttons.Length - 1)
                    {
                        cursorLocation = 0;
                    }
                }

                cursorLocation = dialogueManager.ChangeCursorLocations(cursorLocation);
            }
        }


        if (keyDown.Equals(KeyCode.Escape))
        {
            gameStateManager.SetExploring();
        }

        //Selects an option from the player options
        if (keyDown.Equals(KeyCode.Space))
        {
            cursorLocation = dialogueManager.EncapsulateSpace();
        }
    }