Example #1
0
        void OnDeserialized()
        {
            m_contentArray = new KeyedObjectCollection[this.Depth];
            for (int i = 0; i < this.Depth; ++i)
            {
                m_contentArray[i] = new KeyedObjectCollection();
            }

            foreach (var ob in this.Contents)
            {
                m_contentArray[ob.Z].Add(ob);
            }

            CreateLevelMap();

            CommonInit(false);
        }
Example #2
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);
            });
        }
Example #3
0
 protected ContainerObject(ObjectType objectType)
     : base(objectType)
 {
     m_contents    = new KeyedObjectCollection();
     this.Contents = new ReadOnlyCollection <MovableObject>(m_contents);
 }