Exemplo n.º 1
0
        /// <summary>
        /// Draws a Random Path
        /// </summary>
        void RandomPath()
        {
            // Sets random start and end tiles
            int tileStart = Random.Range(0, hexa.tiles.Length - 1);
            int tileEnd   = Random.Range(0, hexa.tiles.Length - 1);

            // Compute path
            List <int> steps = hexa.FindPath(tileStart, tileEnd);

            if (steps == null)
            {
                return;                 // no path found between tileStart and tileEnd
            }
            // Show the path
            hexa.SetTileColor(steps, Color.white, true);
            hexa.SetTileColor(tileStart, Color.red, true);
            hexa.SetTileColor(tileEnd, Color.green, true);

            hexa.FlyTo(tileEnd, 2f);
        }