Beispiel #1
0
 public Class46(string string_2, string string_3)
 {
     Func<Cell, bool> func = null;
     this.scene_0 = null;
     this.d3Actor_0 = null;
     this.vector3_0 = null;
     this.bool_1 = false;
     this.cell_0 = null;
     this.list_0 = null;
     this.int_0 = 0;
     this.list_1 = null;
     this.ienumerable_0 = null;
     this.cell_1 = null;
     this.list_2 = null;
     this.int_1 = 0;
     this.list_3 = new List<Vector3>();
     this.int_2 = 0;
     this.int_3 = 0;
     //base..ctor();
     this.finderState_0 = Class46.FinderState.SearchForTargetScene;
     if (string.IsNullOrWhiteSpace(string_2))
     {
         IEnumerable<Scene> arg_B3_0 = Framework.Navigator.LoadedScenes;
         if (Class46.func_0 == null)
         {
             Class46.func_0 = new Func<Scene, bool>(Class46.smethod_1);
         }
         Scene scene = arg_B3_0.First(Class46.func_0);
         IEnumerable<Cell> arg_D5_0 = Framework.Navigator.AllCells;
         if (func == null)
         {
             func = new Func<Cell, bool>(this.method_3);
         }
         this.ienumerable_0 = arg_D5_0.Where(func);
         this.scene_0 = scene;
         this.string_0 = scene.SNOName;
         this.finderState_0 = Class46.FinderState.SearchForUnit;
     }
     else
     {
         this.string_0 = string_2;
     }
     if (string.IsNullOrWhiteSpace(string_3))
     {
         this.bool_0 = true;
         this.string_1 = "";
     }
     else
     {
         this.bool_0 = false;
         this.string_1 = string_3;
     }
 }
Beispiel #2
0
 private static void smethod_0(Cell cell_0)
 {
     cell_0.CurrentDistance = -1.0;
     cell_0.FromCell = null;
 }
Beispiel #3
0
 public float method_0(Cell cell_0)
 {
     return Vector3.DistanceSquared(this.vector3_0, cell_0.Center);
 }
Beispiel #4
0
 public bool method_0(Cell cell_1)
 {
     return cell_1.AllowWalk && cell_1 != this.cell_0;
 }
Beispiel #5
0
 internal override void vmethod_1()
 {
     Func<D3Actor, bool> func = null;
     Func<Cell, float> func2 = null;
     this.bool_1 = true;
     if (this.int_0 > 0)
     {
         this.int_0--;
     }
     else
     {
         this.int_0 = 5;
         switch (this.finderState_0)
         {
         case Class46.FinderState.SearchForTargetScene:
             this.method_1();
             break;
         case Class46.FinderState.MoveToTargetScene:
             if (Framework.Scene.Contains(this.string_0))
             {
                 if (this.bool_0)
                 {
                     GClass0.smethod_0().method_5("Maze: Complete");
                 }
                 else
                 {
                     this.finderState_0 = Class46.FinderState.SearchForUnit;
                     GClass0.smethod_0().method_5("Maze: found target scene, now looking for: " + this.string_1);
                 }
             }
             else
             {
                 if (this.list_1 == null || this.int_2 != Class45.LastRan || this.int_3 != Class48.LastRan)
                 {
                     this.int_2 = Class45.LastRan;
                     this.int_3 = Class48.LastRan;
                     this.list_1 = Framework.Navigator.GetPath(Framework.Hero.Position, this.cell_1.Center, 10f, 20f);
                 }
                 while (this.list_1.Count > 0 && Framework.Hero.DistanceTo(this.list_1[0]) < 20f)
                 {
                     this.list_1.RemoveAt(0);
                 }
                 if (this.list_1.Count > 0)
                 {
                     Movement.MoveTo(this.list_1[0]);
                 }
                 else
                 {
                     this.finderState_0 = Class46.FinderState.SearchForTargetScene;
                 }
             }
             break;
         case Class46.FinderState.SearchForUnit:
         {
             IEnumerable<D3Actor> arg_1BA_0 = Framework.Actors;
             if (func == null)
             {
                 func = new Func<D3Actor, bool>(this.method_4);
             }
             this.d3Actor_0 = arg_1BA_0.FirstOrDefault(func);
             if (this.d3Actor_0 != null)
             {
                 this.finderState_0 = Class46.FinderState.MoveToUnit;
                 GClass0.smethod_0().method_5("Maze: Target found: " + this.string_1);
             }
             else
             {
                 if (this.cell_0 != null && Framework.Hero.DistanceTo(this.cell_0.Center) < 30f)
                 {
                     this.cell_0 = null;
                 }
                 if (this.cell_0 == null)
                 {
                     this.cell_0 = this.ienumerable_0.ElementAtOrDefault(Class46.random_0.Next(this.ienumerable_0.Count<Cell>()));
                 }
                 if (this.cell_0 != null)
                 {
                     Movement.MoveTo(this.cell_0.Center);
                 }
             }
             break;
         }
         case Class46.FinderState.MoveToUnit:
             if (this.cell_0 == null)
             {
                 IEnumerable<Cell> arg_2A5_0 = this.ienumerable_0;
                 if (func2 == null)
                 {
                     func2 = new Func<Cell, float>(this.method_5);
                 }
                 this.cell_0 = arg_2A5_0.OrderBy(func2).FirstOrDefault<Cell>();
             }
             if (this.cell_0 != null)
             {
                 this.list_0 = Framework.Navigator.GetPath(Framework.Hero.Position, this.cell_0.Center, 10f, 20f);
                 while (this.list_0.Count > 0 && Framework.Hero.DistanceTo(this.list_0[0]) < 20f)
                 {
                     this.list_0.RemoveAt(0);
                 }
                 if (this.list_0.Count > 0)
                 {
                     Movement.MoveTo(this.list_0[0]);
                 }
             }
             break;
         default:
             throw new InvalidOperationException("Maze internal state corrupted");
         }
     }
 }
Beispiel #6
0
 public void method_0(Class15 class15_0)
 {
     Cell cell_ = new Cell(class15_0.method_0() + this.float_0, class15_0.method_1() + this.float_1, class15_0.method_3() + this.float_0, class15_0.method_4() + this.float_1, this.float_2 + class15_0.method_2(), this.float_2 + class15_0.method_5(), class15_0.method_6().HasFlag(Class16.Enum1.flag_0), class15_0.method_6().HasFlag(Class16.Enum1.flag_10), this.class23_0.scene_0);
     this.class23_0.navi_0.method_8(cell_);
 }
Beispiel #7
0
 private List<Cell> method_9(Cell cell_0)
 {
     Navi.Class14 @class = new Navi.Class14();
     @class.cell_0 = cell_0;
     List<Cell> list = new List<Cell>();
     foreach (Cell current in this.list_0.Where(new Func<Cell, bool>(@class.method_0)))
     {
         list.Add(current);
     }
     return list;
 }
Beispiel #8
0
 private Vector3 method_1(Cell cell_0, Cell cell_1)
 {
     Vector3 result;
     if (Math.Abs(cell_0.XMin - cell_1.XMax) < 0.1f)
     {
         float num = 0.5f * (cell_1.YMin + cell_1.YMax);
         if (num < cell_0.YMin)
         {
             num = cell_0.YMin;
         }
         if (num > cell_0.YMax)
         {
             num = cell_0.YMax;
         }
         result = new Vector3(cell_1.XMax, num, cell_1.Single_2);
     }
     else
     {
         if (Math.Abs(cell_0.XMax - cell_1.XMin) < 0.1f)
         {
             float num = 0.5f * (cell_1.YMin + cell_1.YMax);
             if (num < cell_0.YMin)
             {
                 num = cell_0.YMin;
             }
             if (num > cell_0.YMax)
             {
                 num = cell_0.YMax;
             }
             result = new Vector3(cell_1.XMin, num, cell_1.Single_2);
         }
         else
         {
             if (Math.Abs(cell_0.YMax - cell_1.YMin) < 0.1f)
             {
                 float num2 = 0.5f * (cell_1.XMin + cell_1.XMax);
                 if (num2 < cell_0.XMin)
                 {
                     num2 = cell_0.XMin;
                 }
                 if (num2 > cell_0.XMax)
                 {
                     num2 = cell_0.XMax;
                 }
                 result = new Vector3(num2, cell_1.YMin, cell_1.Single_2);
             }
             else
             {
                 if (Math.Abs(cell_0.YMin - cell_1.YMax) < 0.1f)
                 {
                     float num2 = 0.5f * (cell_1.XMin + cell_1.XMax);
                     if (num2 < cell_0.XMin)
                     {
                         num2 = cell_0.XMin;
                     }
                     if (num2 > cell_0.XMax)
                     {
                         num2 = cell_0.XMax;
                     }
                     result = new Vector3(num2, cell_1.YMax, cell_1.Single_2);
                 }
                 else
                 {
                     result = new Vector3(cell_1.Single_0, cell_1.Single_1, cell_1.Single_2);
                 }
             }
         }
     }
     return result;
 }
Beispiel #9
0
 public float DistanceTo(Cell cell)
 {
     float num = cell.Single_0 - this.Single_0;
     float num2 = cell.Single_1 - this.Single_1;
     return (float)Math.Sqrt(Math.Pow((double)num, 2.0) + Math.Pow((double)num2, 2.0));
 }
Beispiel #10
0
 private float method_8(Cell cell_2)
 {
     return (this.scene_0.Center - cell_2.Center).LengthSquared();
 }
Beispiel #11
0
 private bool method_7(Cell cell_2)
 {
     return cell_2.AllowWalk && cell_2.ParentScene == this.scene_0;
 }
Beispiel #12
0
 private float method_5(Cell cell_2)
 {
     return (cell_2.Center - this.d3Actor_0.Position).LengthSquared();
 }
Beispiel #13
0
 private void method_1()
 {
     Func<Scene, bool> func = null;
     Func<Cell, bool> func2 = null;
     Func<Cell, float> func3 = null;
     Func<Vector3, float> func4 = null;
     if (Framework.Navigator.LoadedScenes.Count != this.int_1 || Class45.LastRan != this.int_2 || Class48.LastRan != this.int_3)
     {
         this.int_3 = Class48.LastRan;
         this.int_2 = Class45.LastRan;
         this.int_1 = Framework.Navigator.LoadedScenes.Count;
         this.list_3.Clear();
     }
     if (this.scene_0 == null)
     {
         IEnumerable<Scene> arg_9E_0 = Framework.Navigator.LoadedScenes;
         if (func == null)
         {
             func = new Func<Scene, bool>(this.method_6);
         }
         this.scene_0 = arg_9E_0.FirstOrDefault(func);
     }
     else
     {
         if (this.ienumerable_0 == null)
         {
             IEnumerable<Cell> arg_D7_0 = Framework.Navigator.AllCells;
             if (func2 == null)
             {
                 func2 = new Func<Cell, bool>(this.method_7);
             }
             this.ienumerable_0 = arg_D7_0.Where(func2);
         }
         if (this.cell_1 == null)
         {
             IEnumerable<Cell> arg_107_0 = this.ienumerable_0;
             if (func3 == null)
             {
                 func3 = new Func<Cell, float>(this.method_8);
             }
             this.cell_1 = arg_107_0.OrderBy(func3).First<Cell>();
         }
         this.list_2 = Framework.Navigator.GetPath(Framework.Hero.Position, this.cell_1.Center, 10f, 20f);
         if (this.list_2.Count > 0)
         {
             this.finderState_0 = Class46.FinderState.MoveToTargetScene;
             this.vector3_0 = new Vector3?(this.list_2.Last<Vector3>());
             return;
         }
     }
     List<Vector3> openEnds = Framework.Navigator.OpenEnds;
     if (this.scene_0 == null && openEnds.Count == 0)
     {
         GClass0.smethod_0().method_4("Explorer: Target was not found!");
     }
     else
     {
         if (this.list_3 != null && this.list_3.Count > 0)
         {
             while (this.list_3.Count > 0 && Framework.Hero.DistanceTo(this.list_3[0]) < 20f)
             {
                 this.list_3.RemoveAt(0);
             }
             if (this.list_3.Count > 0)
             {
                 Movement.MoveTo(this.list_3[0]);
             }
         }
         else
         {
             if (this.scene_0 != null)
             {
                 IEnumerable<Vector3> arg_261_0 = openEnds;
                 if (func4 == null)
                 {
                     func4 = new Func<Vector3, float>(this.method_9);
                 }
                 IOrderedEnumerable<Vector3> orderedEnumerable = arg_261_0.OrderBy(func4);
                 foreach (Vector3 current in orderedEnumerable)
                 {
                     List<Vector3> path = Framework.Navigator.GetPath(Framework.Hero.Position, current, 10f, 20f);
                     if (path.Count > 0)
                     {
                         this.list_3 = path;
                         return;
                     }
                 }
                 GClass0.smethod_0().method_4("Explorer: Cannot progress....");
             }
             else
             {
                 IOrderedEnumerable<Vector3> orderedEnumerable2;
                 if (this.vector3_0.HasValue)
                 {
                     orderedEnumerable2 = openEnds.OrderBy(new Func<Vector3, float>(this.method_10));
                 }
                 else
                 {
                     IEnumerable<Vector3> arg_332_0 = openEnds;
                     if (Class46.func_1 == null)
                     {
                         Class46.func_1 = new Func<Vector3, float>(Class46.smethod_2);
                     }
                     orderedEnumerable2 = arg_332_0.OrderBy(Class46.func_1);
                 }
                 foreach (Vector3 current in orderedEnumerable2)
                 {
                     this.list_3 = Framework.Navigator.GetPath(Framework.Hero.Position, current, 10f, 20f);
                     while (this.list_3.Count > 0 && Framework.Hero.DistanceTo(this.list_3[0]) < 20f)
                     {
                         this.list_3.RemoveAt(0);
                     }
                     if (this.list_3.Count > 0)
                     {
                         Movement.MoveTo(this.list_3[0]);
                         return;
                     }
                 }
                 GClass0.smethod_0().method_5("Cannot find a path to explore");
             }
         }
     }
 }
Beispiel #14
0
 private static bool smethod_3(Cell cell_0)
 {
     return cell_0.AllowWalk;
 }
Beispiel #15
0
 public bool method_0(Cell cell_0)
 {
     return this.vector2_0.float_0 < cell_0.XMax && cell_0.XMin < this.vector2_0.float_0 && this.vector2_0.float_1 < cell_0.YMax && cell_0.YMin < this.vector2_0.float_1;
 }
Beispiel #16
0
 private List<Cell> method_0(Cell cell_0, Cell cell_1)
 {
     Navi.Class27 @class = new Navi.Class27();
     @class.cell_1 = cell_1;
     List<Cell> result;
     if (cell_0 == @class.cell_1)
     {
         result = new List<Cell>();
     }
     else
     {
         @class.cell_0 = null;
         List<Cell> arg_50_0 = this.list_0;
         if (Navi.action_0 == null)
         {
             Navi.action_0 = new Action<Cell>(Navi.smethod_0);
         }
         arg_50_0.ForEach(Navi.action_0);
         @class.sortedList_0 = new SortedList<double, Cell>();
         cell_0.CurrentDistance = 0.0;
         @class.sortedList_0.Add(0.0, cell_0);
         KeyValuePair<double, Cell> keyValuePair = default(KeyValuePair<double, Cell>);
         @class.action_0 = null;
         @class.action_0 = new Action<Cell>(@class.method_0);
         while (@class.sortedList_0.Count > 0 && @class.cell_0 == null)
         {
             keyValuePair = @class.sortedList_0.First<KeyValuePair<double, Cell>>();
             @class.action_0(keyValuePair.Value);
             @class.sortedList_0.Remove(keyValuePair.Key);
         }
         List<Cell> list = new List<Cell>();
         if (@class.cell_0 != null)
         {
             list.Add(@class.cell_0);
             while (@class.cell_0.FromCell != null)
             {
                 @class.cell_0 = @class.cell_0.FromCell;
                 list.Insert(0, @class.cell_0);
             }
         }
         result = list;
     }
     return result;
 }
Beispiel #17
0
 public bool method_1(Cell cell_1)
 {
     return cell_1.YMax == this.cell_0.YMin && cell_1.XMin <= this.vector2_0.float_0 && cell_1.XMax >= this.vector2_0.float_0;
 }
Beispiel #18
0
 private void method_8(Cell cell_0)
 {
     foreach (Cell current in this.method_9(cell_0))
     {
         current.AdjacentCells.Add(cell_0);
         cell_0.AdjacentCells.Add(current);
     }
     this.list_0.Add(cell_0);
 }
Beispiel #19
0
 public bool method_3(Cell cell_1)
 {
     return cell_1.XMin == this.cell_0.XMax && cell_1.YMin <= this.vector2_0.float_1 && cell_1.YMax >= this.vector2_0.float_1;
 }
Beispiel #20
0
 public bool method_0(Cell cell_1)
 {
     return (Math.Abs(cell_1.YMax - this.cell_0.YMin) < 0.1f && cell_1.XMin < this.cell_0.XMax && cell_1.XMax > this.cell_0.XMin) || (Math.Abs(cell_1.YMin - this.cell_0.YMax) < 0.1f && cell_1.XMin < this.cell_0.XMax && cell_1.XMax > this.cell_0.XMin) || (Math.Abs(cell_1.XMax - this.cell_0.XMin) < 0.1f && cell_1.YMin < this.cell_0.YMax && cell_1.YMax > this.cell_0.YMin) || (Math.Abs(cell_1.XMin - this.cell_0.XMax) < 0.1f && cell_1.YMin < this.cell_0.YMax && cell_1.YMax > this.cell_0.YMin);
 }
Beispiel #21
0
 public void method_0(Cell cell_2)
 {
     Navi.Class27.Class28 @class = new Navi.Class27.Class28();
     @class.class27_0 = this;
     @class.cell_0 = cell_2;
     if (@class.cell_0 == this.cell_1)
     {
         this.cell_0 = @class.cell_0;
     }
     else
     {
         foreach (Cell current in @class.cell_0.AdjacentCells.Where(new Func<Cell, bool>(@class.method_0)))
         {
             double num = @class.cell_0.CurrentDistance + (double)@class.cell_0.DistanceTo(current);
             if (current.CurrentDistance == -1.0 || current.CurrentDistance > num)
             {
                 current.CurrentDistance = num;
                 current.FromCell = @class.cell_0;
                 if (!this.sortedList_0.ContainsKey(current.CurrentDistance))
                 {
                     this.sortedList_0.Add(current.CurrentDistance, current);
                 }
                 else
                 {
                     this.action_0(current);
                 }
             }
         }
     }
 }
Beispiel #22
0
 public bool method_0(Cell cell_0)
 {
     return cell_0.XMax >= this.vector2_0.float_0 && cell_0.XMin <= this.vector2_0.float_0 && cell_0.YMin <= this.vector2_0.float_1 && cell_0.YMax >= this.vector2_0.float_1;
 }
Beispiel #23
0
 public void method_2()
 {
     this.int_2 = -1;
     this.finderState_0 = Class46.FinderState.SearchForTargetScene;
     this.cell_0 = null;
     this.list_0 = null;
     this.list_1 = null;
     this.d3Actor_0 = null;
     this.scene_0 = null;
     this.ienumerable_0 = null;
     this.cell_1 = null;
 }