public List <GameObject> getBallMovementModeCoordinates(Vector3 ballVector)
    {
        if (!GridHighlighter.Instance.BallMovementMode)
        {
            return(new List <GameObject>());
        }

        CollisionMap map = getCollisionMap(ballVector);
        Coordinate   playerCoordinate = new Coordinate(player.transform.position);
        Coordinate   ballCoordinate   = new Coordinate(ballVector);
        char         direction        = playerCoordinate.getDirection(ballCoordinate);

        List <Coordinate> availableCoordinates = new List <Coordinate>();

        Coordinate nextCoordinate = new Coordinate(ballCoordinate, direction);

        while (true)
        {
            // if the next coordinate is within boundaries AND is not blocked by something...
            if (map.getElement(nextCoordinate) != null && !map.getElement(nextCoordinate).Blocked)
            {
                availableCoordinates.Add(ballCoordinate);
                ballCoordinate = new Coordinate(ballCoordinate, direction);
                nextCoordinate = new Coordinate(nextCoordinate, direction);
            }
            else
            {
                // Player can not move anymore. exit loop
                break;
            }
        }

        List <GameObject> listOfGameObjectPlatforms = new List <GameObject>();

        availableCoordinates.ForEach(delegate(Coordinate coord)
        {
            GameObject platform = gameObjects.getPlatform(coord);
            if (platform != null)
            {
                listOfGameObjectPlatforms.Add(platform);
            }
        });

        return(listOfGameObjectPlatforms);
    }
    private void moveToNewPosition()
    {
        movingFromCoordinate = new Coordinate(player.transform.position).toVector3D(player.transform.position.y);
        Coordinate nextCoordinate = null;

        if (this.path != null)
        {
            nextCoordinate = this.path.getNext();
            if (nextCoordinate != null)
            {
                movingToCoordinate = nextCoordinate.toVector3D(player.transform.position.y);
            }
        }

        if (nextCoordinate == null)
        {
            startTime     = 0;
            journeyLength = 0;
            this.path     = null;
            movingPlayer  = false;
            ballToMove    = null;

            GridHighlighter.Instance.BallMovementMode           = false;
            GridHighlighter.Instance.BallMovementModeTargetBall = null;
        }
        else
        {
            bool playerCollidesWithBall         = false;
            bool playerCannotMoveDueToBallBlock = false;

            Coordinate playerCoordinate = new Coordinate(player.transform.position);

            GameObject ball = gameObjects.movableObjects.Find(x => new Coordinate(x.transform.position).Equals(nextCoordinate));
            playerCollidesWithBall = ball != null;

            if (playerCollidesWithBall)
            {
                // If we continue in this direction, will be ball collide with anything else?
                char       dir      = playerCoordinate.getDirection(nextCoordinate);
                Coordinate newCoord = new Coordinate(nextCoordinate, dir);

                CollisionMap map = getCollisionMap(movingToCoordinate);

                // if the next coordinate is blocked
                if (map.getElement(newCoord) == null || map.getElement(newCoord).Blocked)
                {
                    playerCannotMoveDueToBallBlock = true;
                }
                else
                {
                    ballToMove = ball;
                    movingBallFromCoordinate = new Coordinate(ball.transform.position).toVector3D(ball.transform.position.y);
                    movingBallToCoordinate   = newCoord.toVector3D(ball.transform.position.y);
                }
            }

            if (!playerCollidesWithBall)
            {
                playerCannotMoveDueToBallBlock = false;
            }

            if (!playerCannotMoveDueToBallBlock)
            {
                startTime     = Time.time;
                journeyLength = Vector3.Distance(player.transform.position, movingToCoordinate);
                movingPlayer  = true;
            }
            else
            {
                // The player cannot move because it is being blocked by a ball being blocked
                // by something else!
                startTime     = 0;
                journeyLength = 0;
                this.path     = null;
                movingPlayer  = false;

                ballToMove = null;
            }
        }
    }