Ejemplo n.º 1
0
    public void spawn_map(int radius = 8)
    {
        /// <summary>
        /// Spawns empty hex tiles on the tactical map. Size is determined by the <paramref name="radius"/> parameter
        /// <param name="radius">Radius of the tactical map</param>
        /// </summary>

        hex_dict = new Dictionary <int, Dictionary <int, Dictionary <int, HexCoord> > >();

        for (int a = -radius + 1; a < radius; a++)
        {
            hex_dict.Add(a, new Dictionary <int, Dictionary <int, HexCoord> >());
            for (int b = -radius + 1; b < radius; b++)
            {
                hex_dict[a].Add(b, new Dictionary <int, HexCoord>());
                int c = -(a + b);

                if (Mathf.Abs(c) > radius)
                {
                    continue;
                }

                GameObject tile = Instantiate(Resources.Load("HexTile")) as GameObject;
                HexCoord   hxc  = tile.GetComponent <HexCoord>();
                hxc.set_abc(a, b, c);

                hex_dict[a][b].Add(c, hxc);
            }
        }
    }