示例#1
0
文件: Map.cs 项目: lb71104208/Scratch
        public static List <Vector3Int> FindPath(Tilemap tilemap, Vector3Int startPoint, Vector3Int destPoint)
        {
            List <Node>       pathNode = PathFinding.A_Star(PathFinding.map[startPoint], PathFinding.map[destPoint]);
            List <Vector3Int> pathPos  = new List <Vector3Int>();

            foreach (Node node in pathNode)
            {
                pathPos.Add(node.Position);
            }
            return(pathPos);
        }
示例#2
0
文件: App.cs 项目: stainboy/fe4
        static void Main(string[] args)
        {
            var map  = new Map("map1.yml");
            var algo = new PathFinding(map);

            // show allie's possible movements
            foreach (var f in map.Allies)
            {
                var movements = algo.CalculatePossibleMovements(f);
                map.Print(movements);
            }

            // show ememy's path finding against weakest allie
            var w = map.Allies[2];

            foreach (var e in map.Enemies)
            {
                var movements = algo.CalculateShortestPath(e, w);
                map.Print(movements);
            }
        }