Esempio n. 1
0
        public static CellModel FindFarthestPosition(this GridModel grid, CellModel cell, Vector vector, out CellModel next)
        {
            CellModel previous;

            // Progress towards the vector direction until an obstacle is found
            do
            {
                previous = cell;
                cell = grid[previous.PosX + vector.x, previous.PosY + vector.y];
            }
            while (cell != null && cell.IsAvailable);

            next = cell; // Used to check if a merge is required
            return previous;
        }