Exemplo n.º 1
0
        static public float Heuristic(TileMapGraphNode a, TileMapGraphNode b)
        {
            Vector2 aPos = a.GetTileMapPosition();
            Vector2 bPos = b.GetTileMapPosition();

            return(Mathf.Abs(aPos.x - bPos.x) + Mathf.Abs(aPos.y - bPos.y));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Calculate the movement cost between two GraphNodes
        /// </summary>
        public float CalculateMovementCost(TileMapGraphNode from, TileMapGraphNode to)
        {
            if (to.IsWall())
            {
                return(Mathf.Inf);
            }

            return(from.GetTileMapPosition().DistanceSquaredTo(to.GetTileMapPosition()));
        }