Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (selectKeyPressed)
        {
            if (Input.GetAxis("Select") == 0)
            {
                selectKeyPressed = false;
            }
        }
        switch (gameDriver.gameState)
        {
        case GameState.OverWorld:
            if (Input.GetAxis("Vertical") >= 0.001 || Input.GetAxis("Vertical") <= -0.001)
            {
                this.transform.position += this.transform.forward * speed * Input.GetAxis("Vertical");
            }

            if (Input.GetAxis("Horizontal") >= 0.001 || Input.GetAxis("Horizontal") <= -0.001)
            {
                this.transform.Rotate(0f, rotationFactor * Input.GetAxis("Horizontal"), 0f);
            }

            if (Input.GetAxis("Select") != 0 && !selectKeyPressed && inDialogueRange)
            {
                selectKeyPressed = true;
                gameDriver.StartDialogue();
            }
            break;

        case GameState.Dialogue:
            if (!selectKeyPressed)
            {
                if (Input.GetAxis("Select") > 0)
                {
                    selectKeyPressed = true;
                    gameDriver.AdvanceDialogue();
                }
            }
            break;
        }
    }