Esempio n. 1
0
        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);
        }
Esempio n. 2
0
File: App.cs Progetto: 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);
            }
        }