示例#1
0
    private void Move(int movement)
    {
        int newMovement = -1;

        if (movement == 1)
        {
            newMovement = gridScript.move(DIRECTION.LEFT);
        }

        else if (movement == 2)
        {
            newMovement = gridScript.move(DIRECTION.RIGHT);
        }

        else if (movement == 3)
        {
            newMovement = gridScript.move(DIRECTION.UP);
        }

        else if (movement == 4)
        {
            newMovement = gridScript.move(DIRECTION.DOWN);
        }

        if (newMovement != -1)
        {
            transform.position = cells[newMovement].transform.position;
        }
    }