Пример #1
0
    public void RenderHeightMap()
    {
        var currentColor = texMap.GetRawTextureData <Color32>();
        int w            = heightMap.Width();
        int h            = heightMap.Height();

        for (int i = 0; i < texBoard.width * texBoard.height; i++)
        {
            byte component = (byte)heightMap[i % w, i / h];

            currentColor[i] = new Color32(component, component, component, 255);
        }
        texMap.Apply();
    }
Пример #2
0
    //Gets the sum of the values in a game region
    public int GetGameRegionSum(int x1, int y1, int x2, int y2)
    {
        GridType <int> region = GetGameRegion(x1, y1, x2, y2);

        int sum = 0;

        for (int j = 0; j < region.Height(); j++)
        {
            for (int i = 0; i < region.Width(); i++)
            {
                sum += region[i, j];
            }
        }
        return(sum);
    }
Пример #3
0
    public GridType <int> SumBoards(GridType <int> heightMap)
    {
        var h = heightMap.Height();
        var w = heightMap.Width();

        for (int j = 0; j < h; j++)
        {
            for (int i = 0; i < w; i++)
            {
                heightMap[i, j] += game.GetBoard()[i, j] ? 1 : 0;
            }
        }

        return(heightMap);
    }