Example #1
0
            public HexCell Create(AxialCoordinate coordinate, Vector3 position, HexMap parent)
            {
                HexCell cell = base.Create();

                cell.Coordinate = coordinate;
                cell.transform.SetParent(parent.transform);
                cell.transform.position = position;
                cell.name = coordinate.ToString();
                cell._map = parent;
                return(cell);
            }
Example #2
0
        public void CreateMap(HexMap hexMap)
        {
            HexMap   = hexMap;
            Width    = HexMap.Map.width;
            Height   = HexMap.Map.height;
            _hexMesh = GetComponentInChildren <HexMesh>();
            _hexMesh.Init();
            Cells = new List <HexCell>();
            for (int z = 0, i = 0; z < Height; z++)
            {
                for (var x = 0; x < Width; x++)
                {
                    CreateCell(x, z, i++);
                }
            }

            TriangulateCells();
        }