override public void InitGrid() { var imageRect = new Rect(0, 0, heightMap.width, heightMap.height); var map = new RectMap(new Vector2(40, 40)); var map2D = new ImageMap <RectPoint>(imageRect, Grid, map); foreach (var point in Grid) { int x = Mathf.FloorToInt(map2D[point].x); int y = Mathf.FloorToInt(map2D[point].y); float height = heightMap.GetPixel(x, y).r * 4; if (height <= 0) { height = 0.01f; } var block = Grid[point]; if (block == null) { Debug.LogWarning("block is null " + point); } else { block.Color = ExampleUtils.Blend(height, ExampleUtils.Colors[0], ExampleUtils.Colors[1]); block.transform.localScale = new Vector3(1, height, 1); } } }
private void UpdateCell(PointyHexPoint point) { Color newColor = ExampleUtils.Blend(gas[point], offColor, onColor); Grid[point].Color = newColor; }