Exemplo n.º 1
0
        /// <summary>
        /// Computes the shortest path between two random cells of the hexagonal grid
        /// </summary>
        void RandomPathFind()
        {
            int startCellIndex = -1, endCellIndex = -1;

            for (int k = 0; k < 1000; k++)                                                                                        // This loop ensure enough tries while avoiding infinite search
            {
                startCellIndex = GetRandomVisibleCellIndex();
                endCellIndex   = GetRandomVisibleCellIndex();
                if (DrawPath(startCellIndex, endCellIndex))
                {
                    break;
                }
            }

            // Navigate to show the path
            map.FlyToCell(startCellIndex, 2f);
        }