Exemple #1
0
        // Disposer
        public override void Dispose()
        {
            // Not already disposed?
            if (!IsDisposed)
            {
                // Clean up
                sides   = null;
                floor   = null;
                ceiling = null;

                // Dispose base
                base.Dispose();
            }
        }
Exemple #2
0
        // This (re)builds the visual sector, calculating all geometry from scratch
        public void Rebuild()
        {
            // Forget old geometry
            base.ClearGeometry();

            // Create floor
            if (floor == null)
            {
                floor = new VisualFloor(mode, this);
            }
            floor.Setup();
            base.AddGeometry(floor);

            // Create ceiling
            if (ceiling == null)
            {
                ceiling = new VisualCeiling(mode, this);
            }
            ceiling.Setup();
            base.AddGeometry(ceiling);

            // Go for all sidedefs
            Dictionary <Sidedef, VisualWallParts> oldsides = sides ?? new Dictionary <Sidedef, VisualWallParts>(1);

            sides = new Dictionary <Sidedef, VisualWallParts>(base.Sector.Sidedefs.Count);
            foreach (Sidedef sd in base.Sector.Sidedefs)
            {
                // VisualSidedef already exists?
                VisualWallParts parts = oldsides.ContainsKey(sd) ? oldsides[sd] : new VisualWallParts();

                // Doublesided or singlesided?
                if (sd.Other != null)
                {
                    // Create upper part
                    VisualUpper vu = parts.upper ?? new VisualUpper(mode, this, sd);
                    vu.Setup();
                    base.AddGeometry(vu);

                    // Create lower part
                    VisualLower vl = parts.lower ?? new VisualLower(mode, this, sd);
                    vl.Setup();
                    base.AddGeometry(vl);

                    // Create middle part
                    VisualMiddleDouble vm = parts.middledouble ?? new VisualMiddleDouble(mode, this, sd);
                    vm.Setup();
                    base.AddGeometry(vm);

                    // Store
                    sides.Add(sd, new VisualWallParts(vu, vl, vm));
                }
                else
                {
                    // Create middle part
                    VisualMiddleSingle vm = parts.middlesingle ?? new VisualMiddleSingle(mode, this, sd);
                    vm.Setup();
                    base.AddGeometry(vm);

                    // Store
                    sides.Add(sd, new VisualWallParts(vm));
                }
            }

            // Done
            changed = false;
        }