Exemple #1
0
        public IWorld(IPhysicWorld PhysicWorld, ICuller Culler, IParticleManager particleManager = null)
#endif
        {
            if (PhysicWorld == null)
            {
                ActiveLogger.LogMessage("Physic World cannot be null", LogLevel.FatalError);
                Debug.Assert(PhysicWorld != null);
                throw new Exception("Physic World cannot be null");
            }
            if (Culler == null)
            {
                ActiveLogger.LogMessage("Culler cannot be null", LogLevel.FatalError);
                Debug.Assert(Culler != null);
                throw new Exception("Culler cannot be null");
            }

            this.particleManager = particleManager;
            this.PhysicWorld     = PhysicWorld;
            this.CameraManager   = new CameraManager();
            Dummies                 = new List <IDummy>();
            Lights                  = new List <ILight>();
            Objects                 = new List <IObject>();
            Triggers                = new List <ITrigger>();
            SoundEmiters3D          = new List <ISoundEmitter3D>();
            this.Culler             = Culler;
            this.culler.world       = this;
            CleanUpObjectsOnDispose = true;
#if WINDOWS
            this.multThreading = multiThread;
#endif
        }
        public IWorld(IPhysicWorld PhysicWorld, ICuller Culler, IParticleManager particleManager = null)
#endif
        {
            if (PhysicWorld == null)
            {
                ActiveLogger.LogMessage("Physic World cannot be null", LogLevel.FatalError);
                Debug.Assert(PhysicWorld != null);
                throw new Exception("Physic World cannot be null");
            }
            if (Culler == null)
            {
                ActiveLogger.LogMessage("Culler cannot be null", LogLevel.FatalError);
                Debug.Assert(Culler != null);
                throw new Exception("Culler cannot be null");
            }

            this.particleManager = particleManager;            
            this.PhysicWorld = PhysicWorld;            
            this.CameraManager = new CameraManager();            
            Dummies = new List<IDummy>();
            Lights = new List<ILight>();
            Objects = new List<IObject>();
            Triggers = new List<ITrigger>();
            SoundEmiters3D = new List<ISoundEmitter3D>();
            this.Culler = Culler;
            this.culler.world = this;
            CleanUpObjectsOnDispose = true;
#if WINDOWS
            this.multThreading = multiThread;
#endif
        }
Exemple #3
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;
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IWorld"/> class.
 /// </summary>
 /// <param name="PhysicWorld">The physic world.</param>
 /// <param name="Culler">The culler.</param>
 /// <param name="particleManager">The particle manager.</param>
 /// <param name="multiThread">if set to <c>true</c> [mult thread].</param>
 public IWorld(IPhysicWorld PhysicWorld, ICuller Culler, IParticleManager particleManager = null, bool multiThread = false)
 /// <summary>
 /// Initializes a new instance of the <see cref="IWorld"/> class.
 /// </summary>
 /// <param name="PhysicWorld">The physic world.</param>
 /// <param name="Culler">The culler.</param>
 /// <param name="particleManager">The particle manager.</param>
 /// <param name="multiThread">if set to <c>true</c> [mult thread].</param>
 public IWorld(IPhysicWorld PhysicWorld, ICuller Culler, IParticleManager particleManager = null,bool multiThread = false)
        /// <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;
        }