Exemple #1
0
        /// <summary>
        /// Generate the moving path for that position
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        public FDMovePath GetPath(FDPosition position)
        {
            if (!directionedScope.ContainsKey(position) || skipPositions.Contains(position))
            {
                return(null);
            }

            FDMovePath path          = new FDMovePath();
            FDPosition current       = position;
            FDPosition next          = directionedScope[current];
            int        lastDirection = -1;

            while (next != null)
            {
                int direction = next.IsNextToDirection(current);
                if (lastDirection < 0 || direction != lastDirection)
                {
                    path.InsertToHead(current);
                }

                lastDirection = direction;
                current       = next;
                next          = directionedScope[current];
            }

            return(path);
        }
Exemple #2
0
        /// <summary>
        /// Single one position for move path
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        public static FDMovePath Create(FDPosition position)
        {
            FDMovePath movePath = new FDMovePath();

            movePath.Vertexes.Add(position);

            return(movePath);
        }