예제 #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);
            }
        }