Ejemplo n.º 1
0
        /// <summary>
        /// Cleans up.
        /// </summary>
        public virtual void CleanUp()
        {
            foreach (var item in this.CameraManager.GetCamerasDescription())
            {
                item.cam.CleanUp();
            }

            foreach (var item in SoundEmiters3D.ToArray())
            {
                this.RemoveSoundEmitter(item);
            }

            foreach (var item in Triggers.ToArray())
            {
                this.RemoveTrigger(item);
            }

            foreach (var item in Lights.ToArray())
            {
                this.RemoveLight(item);
            }


            if (CleanUpObjectsOnDispose)
            {
                foreach (var item in Objects.ToArray())
                {
                    this.RemoveObject(item);
                    item.CleanUp(graphicFactory);
                }
            }
            else
            {
                foreach (var item in Objects.ToArray())
                {
                    this.RemoveObject(item);
                }
            }



            foreach (var item in SoundEmiters3D)
            {
                item.CleanUp(graphicFactory);
            }

            Objects.Clear();
            Lights.Clear();
            Dummies.Clear();
            this.culler = null;
            SoundEmiters3D.Clear();
            CameraManager = null;
            Triggers.Clear();
            if (particleManager != null)
            {
                particleManager.iCleanUp();
                particleManager = null;
            }
            this.PhysicWorld.iCleanUp();
            this.PhysicWorld = null;
        }