コード例 #1
0
ファイル: MapPoint.cs プロジェクト: Zaetic/Symbioz-2.38-RED
        public MapPoint GetCellSymetrieByPortail(MapPoint target, MapPoint cellExit)
        {
            var dir = OrientationTo(target);
            List <DirectionsEnum> dirs = new List <DirectionsEnum>()
            {
                dir
            };
            MapPoint lastCell = this;
            var      num      = 0;

            while (num < 140)
            {
                lastCell = lastCell.GetCellInDirection(dir, 1);
                dir      = lastCell.OrientationTo(target, true);
                if (lastCell.CellId == target.CellId)
                {
                    break;
                }
                dirs.Add(dir);
                num++;
            }
            lastCell = cellExit;
            foreach (var item in dirs)
            {
                lastCell = lastCell.GetCellInDirection(item, 1);
            }

            return(lastCell);
        }
コード例 #2
0
ファイル: MapPoint.cs プロジェクト: Zaetic/Symbioz-2.38-RED
        public MapPoint[] GetCellsOnLineBetween(MapPoint destination)
        {
            System.Collections.Generic.List <MapPoint> list = new System.Collections.Generic.List <MapPoint>();
            DirectionsEnum direction = this.OrientationTo(destination, true);
            MapPoint       mapPoint  = this;
            int            num       = 0;

            while ((long)num < 140L)
            {
                mapPoint = mapPoint.GetCellInDirection(direction, 1);
                if (mapPoint == null || mapPoint.CellId == destination.CellId)
                {
                    break;
                }
                list.Add(mapPoint);
                num++;
            }
            return(list.ToArray());
        }