void AddTrees()
        {
            for (int y = 0; y < LevelMapSize; y++)
            {
                for (int x = 0; x < LevelMapSize; x++)
                {
                    var location = new CGPoint(x, y);
                    var spot     = treeMap.QueryTreeMap(location);

                    var        treePos   = ConvertLevelMapPointToWorldPoint(location);
                    WorldLayer treeLayer = WorldLayer.Top;
                    Tree       tree;

                    if (spot.SmallTreeLocation >= 200)
                    {
                        // Create small tree at this location.
                        treeLayer = WorldLayer.AboveCharacter;
                        tree      = (Tree)SharedSmallTree.Clone();
                    }
                    else if (spot.BigTreeLocation >= 200)
                    {
                        // Create big tree with leaf emitters at this position.
                        tree = (Tree)SharedBigTree.Clone();

                        // Pick one of the two leaf emitters for this tree.
                        SKEmitterNode emitterToCopy = Random.Next(2) == 1 ? SharedLeafEmitterA : SharedLeafEmitterB;
                        var           emitter       = (SKEmitterNode)emitterToCopy.Copy();

                        emitter.Position = treePos;
                        emitter.Paused   = true;
                        AddNode(emitter, WorldLayer.AboveCharacter);
                        particleSystems.Add(emitter);
                    }
                    else
                    {
                        continue;
                    }

                    tree.Position  = treePos;
                    tree.ZRotation = (float)(Random.NextDouble() * Math.PI * 2);
                    AddNode(tree, treeLayer);
                    parallaxSprites.Add(tree);
                    trees.Add(tree);
                }
            }

            treeMap = null;
        }
        public override void Initialize()
        {
            base.Initialize();

            // Build level and tree maps from map_collision.png and map_foliage.png respectively.
            levelMap = GraphicsUtilities.CreateMapScaner("map_level.png");
            treeMap  = GraphicsUtilities.CreateMapScaner("map_trees.png");

            Cave.GoblinCap = 32;

            BuildWorld();

            // Center the camera on the hero spawn point.
            var startPosition = DefaultSpawnCGPoint;

            CenterWorld(startPosition);
        }