Пример #1
0
        private MovementPath method_3(SimpleCellInfo class13_0)
        {
            var range  = new List <MapPoint>();
            var class2 = class13_0;

            while (class2.v_OriginPoint.CellId != MapPoint_FromCell.CellId)
            {
                class2 = class2.class13_0;
                range.Add(class2.v_OriginPoint);
            }
            range.Reverse();
            range.Add(class13_0.v_OriginPoint);
            if (v_MouvementPoints != -1)
            {
                range = range.GetRange(0, v_MouvementPoints + 1 > range.Count ? range.Count : v_MouvementPoints + 1);
            }
            var path = new MovementPath {
                CellStart = MapPoint_FromCell, CellEnd = range[range.Count - 1]
            };
            var num = range.Count - 2;
            var i   = 0;

            while (i <= num)
            {
                var item = new PathElement {
                    Cell = range[i], Orientation = range[i].OrientationTo(range[i + 1])
                };
                path.Cells.Add(item);
                i += 1;
            }
            path.Compress();
            return(path);
        }
Пример #2
0
        public MovementPath FindPath(int FromCell, int ToCell)
        {
            SimpleCellInfo class3 = null;

            MapPoint_FromCell = new MapPoint(FromCell);
            MapPoint_ToCell   = new MapPoint(ToCell);
            var item = new SimpleCellInfo(MapPoint_FromCell);

            list_0.Add(item);
Label_00BF:
            class3 = method_0();
            if (class3 != null)
            {
                list_0.Remove(class3);
                list_1.Add(class3);
                if (class3.v_OriginPoint.CellId == ToCell)
                {
                    return(method_3(class3));
                }
                foreach (var point in class3.method_0(IsInFight))
                {
                    if (Convert.ToBoolean(method_2(point.CellId)))
                    {
                        method_1(new SimpleCellInfo(MapData, point, class3, MapPoint_ToCell));
                    }
                }
                goto Label_00BF;
            }
            return(null);
        }
Пример #3
0
        public MovementPath FindPath(int FromCell, int ToCell)
        {
            SimpleCellInfo class3 = null;

            MapPoint_FromCell = new MapPoint(FromCell);
            MapPoint_ToCell   = new MapPoint(ToCell);
            var item = new SimpleCellInfo(MapPoint_FromCell);

            list_0.Add(item);
Label_00BF:
            class3 = method_0();
            if (class3 != null)
            {
                list_0.Remove(class3);
                list_1.Add(class3);
                if (class3.v_OriginPoint.CellId == ToCell)
                {
                    return(method_3(class3));
                }
                //INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
                //				MapPoint point = null;
                foreach (var point in class3.method_0(IsInFight))
                {
                    if (Convert.ToBoolean(method_2(point.CellId)))
                    {
                        method_1(new SimpleCellInfo(MapData, point, class3, MapPoint_ToCell));
                    }
                }
                goto Label_00BF;
            }
            return(null);
        }
Пример #4
0
 internal SimpleCellInfo(Gamedata.D2p.Map MapData, MapPoint OriginPoint, SimpleCellInfo class13_1,
                         MapPoint mapPoint_2)
 {
     int_0         = 0;
     int_1         = 0;
     v_OriginPoint = OriginPoint;
     class13_0     = class13_1;
     int_1         = mapPoint_2.DistanceToCell(OriginPoint) * 5;
     int_0         = class13_1.int_0 + 10;
     if (class13_1.class13_0 != null)
     {
         var num2 = class13_1.class13_0.v_OriginPoint.OrientationTo(class13_1.v_OriginPoint);
         var num3 = class13_1.v_OriginPoint.OrientationTo(OriginPoint);
         var num  = Math.Abs(Convert.ToInt32(num2 - num3));
         if (num != 0)
         {
             int_0 = int_0 + 5;
             if (num != 1 && num != 7)
             {
                 int_0 = int_0 + 50;
             }
         }
         if (MapData.Cells[OriginPoint.CellId].Speed == 2)
         {
             int_0 = int_0 - 8;
         }
     }
 }
Пример #5
0
 // Methods
 internal SimpleCellInfo(MapPoint OriginPoint)
 {
     int_0         = 0;
     int_1         = 0;
     v_OriginPoint = OriginPoint;
     class13_0     = null;
     int_0         = 0;
 }
Пример #6
0
        private SimpleCellInfo method_0()
        {
            SimpleCellInfo class2 = null;

            foreach (var class3 in list_0)
            {
                if (class2 == null || class2.int_0 + class2.int_1 > class3.int_0 + class3.int_1)
                {
                    class2 = class3;
                }
            }
            return(class2);
        }
Пример #7
0
        private SimpleCellInfo method_0()
        {
            SimpleCellInfo class2 = null;

            //INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
            //			SimpleCellInfo class3 = null;
            foreach (var class3 in list_0)
            {
                if (class2 == null || class2.int_0 + class2.int_1 > class3.int_0 + class3.int_1)
                {
                    class2 = class3;
                }
            }
            return(class2);
        }
Пример #8
0
 private void method_1(SimpleCellInfo class13_0)
 {
     foreach (var class2 in list_0)
     {
         if (class2.v_OriginPoint.CellId == class13_0.v_OriginPoint.CellId &&
             class2.int_0 + class2.int_1 <= class13_0.int_0 + class13_0.int_1)
         {
             return;
         }
     }
     foreach (var class3 in list_1)
     {
         if (class3.v_OriginPoint.CellId == class13_0.v_OriginPoint.CellId &&
             class3.int_0 + class3.int_1 <= class13_0.int_0 + class13_0.int_1)
         {
             return;
         }
     }
     list_0.Add(class13_0);
 }
Пример #9
0
 private void method_1(SimpleCellInfo class13_0)
 {
     //INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
     //			SimpleCellInfo class2 = null;
     foreach (var class2 in list_0)
     {
         if (class2.v_OriginPoint.CellId == class13_0.v_OriginPoint.CellId &&
             class2.int_0 + class2.int_1 <= class13_0.int_0 + class13_0.int_1)
         {
             return;
         }
     }
     //INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
     //			SimpleCellInfo class3 = null;
     foreach (var class3 in list_1)
     {
         if (class3.v_OriginPoint.CellId == class13_0.v_OriginPoint.CellId &&
             class3.int_0 + class3.int_1 <= class13_0.int_0 + class13_0.int_1)
         {
             return;
         }
     }
     list_0.Add(class13_0);
 }