Пример #1
0
    private void CreateCell(HexCell cell, int x, int z)
    {
        int     ran = Random.Range(0, plainMat.Count);
        Vector3 position;

        position.x = (x + z * 0.5f - z / 2) * (HexMetrics.InnerRadius * 2);
        position.y = 0;
        position.z = z * (HexMetrics.OuterRadius * 1.5f);

        cell.InitHexCell();
        cell.GenerateMesh();
        cell.transform.SetParent(transform, false);
        cell.transform.localPosition = position;
        cell.SetMaterial(plainMat[ran]);
        //Debug.Log("cell created");
        cell.coordinate = HexCoordinate.FromOffsetCoordinate(x, z);
        cell.index      = x + z * mapWidth;
        hiddenCells.Add(cell);
    }