Ejemplo n.º 1
0
    void MoveInDirection(Vector2 direction)
    {
        if (playerMover.isMoving || m_gameManager.IgnoreInput())
        {
            return;
        }

        if (direction.x < 0)
        {
            StartCoroutine(Utility.HighlightGUIObject(leftButton, m_buttonColor));
        }
        else if (direction.x > 0)
        {
            StartCoroutine(Utility.HighlightGUIObject(rightButton, m_buttonColor));
        }
        else if (direction.y < 0)
        {
            StartCoroutine(Utility.HighlightGUIObject(downButton, m_buttonColor));
        }
        else if (direction.y > 0)
        {
            StartCoroutine(Utility.HighlightGUIObject(upButton, m_buttonColor));
        }

        Node previousNode = playerMover.AttemptMove(direction);

        if (previousNode)
        {
            // store the previous node
            m_steps.Add(previousNode);
        }
    }