Assets.MapGenerator1.Draw C# (CSharp) Method

Draw() private method

private Draw ( ) : void
return void
        private void Draw()
        {
            var thisMatrix = transform.localToWorldMatrix;
            if (map == null) return;

            for (int x = 0; x < Width; x++)
                for (int y = 0; y < Height; y++)
                {
                    // There should not be a tree here
                    if (map[x,y] == 0)
                        continue;

                    // Are we outsite the boundary?
                    var pointInPlain = _pointsInPlane[x][y];
                    if (pointInPlain.y < _lowerBoundaryY || pointInPlain.y > _upperBoundaryY)
                        continue;

                    // Spawn the tree at that position
                    Instantiate(Trees[new System.Random().Next(0, Trees.Length)], thisMatrix.MultiplyPoint3x4(pointInPlain), Quaternion.identity);
                }
        }