protected override void Initialize()
        {
            #region создание базовых объектов


            // Создание координат полигона.
            var polygonCoordinates = new Coordinate[] {
                new Coordinate(-6500000, 4500000),
                new Coordinate(-6500000, 2500000),
                new Coordinate(-4500000, 2500000),
                new Coordinate(-4500000, 4500000),
                new Coordinate(-6500000, 4500000)
            };
            // Создание стандартного полигона по ранее созданным координатам.
            polygon = new Polygon(new LinearRing(polygonCoordinates));
            MapObjects.Add(polygon);



            reef = new Reef(-6300000, 4200000);
            MapObjects.Add(reef);

            reef = new Reef(-6000000, 3100000);
            MapObjects.Add(reef);

            reef = new Reef(-5400000, 4200000);
            MapObjects.Add(reef);

            reef = new Reef(-4800000, 3900000);
            MapObjects.Add(reef);

            reef = new Reef(-4700000, 3000000);
            MapObjects.Add(reef);

            #endregion

            #region

            random = new Random(10);

            var submarineCoordinate = new Coordinate(-6300000, 4300000);

            int submarineSpeed = 10000;

            submarine = new Submarine(submarineCoordinate, submarineSpeed);

            MapObjects.Add(submarine);



            for (int i = 0; i < 10; i++)
            {
                int x = random.Next(-6500000, -4500000);
                int y = random.Next(2500000, 4500000);

                var obj = new IntrestingObj(new Coordinate(x, y));

                MapObjects.Add(obj);
            }

            #endregion
        }
        public void MoveToObj(IInheritanceTreeCollection <Geometry> MapObjects)
        {
            IntrestingObj closestObj = FindClosestObj(MapObjects);

            if (IsStuck == 1)
            {
                Console.WriteLine("Я застрял, пытаюсь найти край рифа");

                IsStuck = 2;

                Coordinate reefDownLeftCoordinate = StuckedReef.Coordinates[1];
                if (FindRelativeCoords(reefDownLeftCoordinate).Y < 0)
                {
                    Y = StuckedReef.Coordinates[0].Y + 50000;
                }
                else
                {
                    Y = reefDownLeftCoordinate.Y - 50000;
                }
            }
            else if (IsStuck == 2)
            {
                Console.WriteLine("Край нашёл, теперь обхожу");
                IsStuck = 0;

                Coordinate reefDownLeftCoordinate = StuckedReef.Coordinates[1];
                if (FindRelativeCoords(reefDownLeftCoordinate).X < 0)
                {
                    X = StuckedReef.Coordinates[0].X - 22000;
                }
                else
                {
                    X = reefDownLeftCoordinate.X + 22000;
                }


                StuckedReef = null;
            }
            else
            {
                if (closestObj.Distance(this) <= Speed / 5)
                {
                    if (WaitingTime == 0)
                    {
                        X = closestObj.Coordinate.X;
                        Y = closestObj.Coordinate.Y;
                    }
                    else if (WaitingTime == 10)
                    {
                        MapObjects.Remove(closestObj);
                        WaitingTime = 0;
                    }
                    WaitingTime++;
                }

                Coordinate relativeCoord = FindRelativeCoords(closestObj.Coordinate);
                double     curSpeedX     = Math.Abs(relativeCoord.X) > Speed ? Speed : Speed / 5;
                double     curSpeedY     = Math.Abs(relativeCoord.Y) > Speed ? Speed : Speed / 5;

                double nextX = X + curSpeedX * Math.Sign(relativeCoord.X);
                double nextY = Y + curSpeedY * Math.Sign(relativeCoord.Y);

                var nextCoord = new Coordinate(nextX, nextY);

                Reef stuckedReef = CheckReefs(relativeCoord, MapObjects, nextCoord);

                if (stuckedReef == null)
                {
                    X += curSpeedX * Math.Sign(relativeCoord.X);
                    Y += curSpeedY * Math.Sign(relativeCoord.Y);
                }
                else
                {
                    IsStuck = 1;

                    StuckedReef = stuckedReef;
                }
            }
        }