Beispiel #1
0
        EnvironmentObject(Dwarrowdelf.TerrainGen.TerrainData terrain, VisibilityMode visMode, IntVector3 startLocation)
            : base(ObjectType.Environment)
        {
            this.Version = 1;
            this.VisibilityMode = visMode;

            terrain.GetData(out m_tileGrid, out m_levelMap);

            this.Size = terrain.Size;

            this.StartLocation = startLocation;

            InitFlags();
            VerifyLevelMap();

            m_contentArray = new KeyedObjectCollection[this.Depth];
            for (int i = 0; i < this.Depth; ++i)
                m_contentArray[i] = new KeyedObjectCollection();

            m_originalNumTrees = ParallelEnumerable.Range(0, this.Size.Depth).Sum(z =>
            {
                int sum = 0;
                for (int y = 0; y < this.Size.Height; ++y)
                    for (int x = 0; x < this.Size.Width; ++x)
                        if (GetTileData(x, y, z).HasTree)
                            sum++;

                return sum;
            });
        }