public static NavigationGridCell ReadVersion7(BinaryReader br, int id)
        {
            float centerHeight            = br.ReadSingle();
            int   sessionId               = br.ReadInt32();
            float arrivalCost             = br.ReadSingle();
            bool  isOpen                  = br.ReadUInt32() == 1;
            float heuristic               = br.ReadSingle();
            NavigationGridLocator locator = new NavigationGridLocator(br);
            uint actorList                = br.ReadUInt32();

            br.ReadUInt32();
            int   goodCellSessionId = br.ReadInt32();
            float refHintWeight     = br.ReadSingle();

            br.ReadUInt16();
            short arrivalDirection = br.ReadInt16();

            short[] refHintNode = new short[] { br.ReadInt16(), br.ReadInt16() };

            return(new NavigationGridCell()
            {
                ID = id,
                CenterHeight = centerHeight,
                SessionId = sessionId,
                ArrivalCost = arrivalCost,
                IsOpen = isOpen,
                Heuristic = heuristic,
                ActorList = actorList,
                Locator = locator,
                GoodCellSessionId = goodCellSessionId,
                RefHintWeight = refHintWeight,
                ArrivalDirection = arrivalDirection,
                RefHintNode = refHintNode
            });
        }
Example #2
0
        public NavigationHintNode(BinaryReader br)
        {
            for (int i = 0; i < this.Distances.Length; i++)
            {
                this.Distances[i] = br.ReadSingle();
            }

            this.Locator = new NavigationGridLocator(br);
        }
Example #3
0
 public bool IsAnythingBetween(NavigationGridLocator a, NavigationGridLocator b)
 {
     return(IsAnythingBetween(new Vector2(a.X, a.Y), new Vector2(b.X, b.Y)));
 }
Example #4
0
 public Vector2 TranslateFrmNavigationGrid(NavigationGridLocator locator)
 {
     return(TranslateFrmNavigationGrid(new Vector2(locator.X, locator.Y)));
 }
 public static int Distance(NavigationGridCell a, NavigationGridCell b)
 {
     return(NavigationGridLocator.Distance(a.Locator, b.Locator));
 }
Example #6
0
 public static int Distance(NavigationGridLocator a, NavigationGridLocator b)
 {
     return(Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y));
 }