/// <summary> /// Cleans up. /// </summary> public virtual void CleanUp() { Camera2D.CleanUp(); foreach (var item in Objects.ToArray()) { this.RemoveObject(item); } if (CleanUpObjectsOnDispose) { foreach (var item in Objects) { item.CleanUp(graphicsFactory); } } foreach (var item in SoundEmiters2D.ToArray()) { this.RemoveSoundEmitter(item); } foreach (var item in SoundEmiters2D) { item.CleanUp(graphicsFactory); } Objects.Clear(); Camera2D = null; Dummies.Clear(); SoundEmiters2D.Clear(); particleManager = null; PhysicWorld = null; this.culler = null; }
/// <summary> /// Initializes a new instance of the <see cref="IWorld"/> class. /// </summary> /// <param name="PhysicWorld">The physic world.</param> /// <param name="particleManager">The particle manager.</param> /// <param name="culler">The culler.</param> public I2DWorld(I2DPhysicWorld PhysicWorld, IParticleManager particleManager = null, I2DCuller culler = null) { 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) { this.culler = new Simple2DCuller(); } else { this.culler = culler; } this.culler.world = this; this.particleManager = particleManager; this.PhysicWorld = PhysicWorld; Dummies = new List <IDummy>(); Objects = new List <I2DObject>(); SoundEmiters2D = new List <ISoundEmitter2D>(); CleanUpObjectsOnDispose = true; #if !WINDOWS_PHONE && !REACH Lights2D = new List <PloobsEngine.Light2D.Light2D>(); #endif }