Ejemplo n.º 1
0
        /// <summary>
        /// Removes the light.
        /// </summary>
        /// <param name="light">The light.</param>
        public virtual void RemoveLight(ILight light)
        {
            if (light == null)
            {
                ActiveLogger.LogMessage("Cant remove null Light", LogLevel.RecoverableError);
                return;
            }
            bool resp = Lights.Remove(light);

            if (!resp)
            {
                ActiveLogger.LogMessage("Light not found: " + light.Name, LogLevel.Warning);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a Dummy to the world
        /// Its like a position,
        /// usefull to serializable position from a world editor
        /// </summary>
        /// <param name="dummy">The dummy.</param>
        public virtual void AddDummy(IDummy dummy)
        {
            if (dummy == null)
            {
                ActiveLogger.LogMessage("Cant Add Null dummy", LogLevel.RecoverableError);
                return;
            }

            if (String.IsNullOrEmpty(dummy.Name))
            {
                ActiveLogger.LogMessage("Dummy with no Name", LogLevel.Warning);
            }
            Dummies.Add(dummy);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Removes the dummy.
        /// </summary>
        /// <param name="dummy">The dummy.</param>
        public virtual void RemoveDummy(IDummy dummy)
        {
            if (dummy == null)
            {
                ActiveLogger.LogMessage("Cant Remove Null dummy", LogLevel.RecoverableError);
                return;
            }
            bool resp = Dummies.Remove(dummy);

            if (!resp)
            {
                ActiveLogger.LogMessage("Dummy not found: " + dummy.Name, LogLevel.Warning);
            }
        }
Ejemplo n.º 4
0
        public override void RemoveSoundEmitter(Audio.ISoundEmitter3D em)
        {
            if (em == null)
            {
                ActiveLogger.LogMessage("Emitter is Null " + em.ToString(), LogLevel.RecoverableError);
                return;
            }
            bool resp = SoundEmiters3D.Remove(em);

            if (!resp)
            {
                ActiveLogger.LogMessage("Emitter not found: " + em.ToString(), LogLevel.Warning);
            }
        }
Ejemplo n.º 5
0
        public Texture2D this[DeferredLightMapType type]
        {
            get {
                switch (type)
                {
                case DeferredLightMapType.LIGHTMAP:
                    return(lightRT);

                default:
                    ActiveLogger.LogMessage("DeferredLightMapTypetype not present", LogLevel.FatalError);
                    throw new Exception("Type not present in this implementation");
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Add a camera
        /// if camera name is DEFAULTCAMERA it becomes the active one
        /// </summary>
        /// <param name="cam"></param>
        /// <param name="name"></param>
        public void AddCamera(ICamera cam, String name)
        {
            if (cam == null || String.IsNullOrEmpty(name))
            {
                ActiveLogger.LogMessage("Can add null camera or invalid name, Skipping adding this Camera", LogLevel.RecoverableError);
                return;
            }

            CameraDescription cc;

            cc.cam  = cam;
            cc.name = name;
            _cameras.Add(cc);
        }
        protected override void  AfterLoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory)
        {
            this.ginfo = ginfo;

            if (desc.UseFloatingBufferForLightMap)
            {
                if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.HdrBlendable, DepthFormat.Depth24Stencil8, ginfo.UseMipMap, ginfo.MultiSample) == false)
                {
                    throw new NotSupportedException("The plataform does not support the specified Render target Combination for Deferred Rendering, check the logs for more info");
                }
            }

            if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.Color, DepthFormat.Depth24Stencil8, ginfo.UseMipMap, ginfo.MultiSample) == false)
            {
                throw new NotSupportedException("The plataform does not support the specified Render target Combination for Deferred Rendering, check the logs for more info");
            }

            if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.Single, DepthFormat.Depth24Stencil8, false, 0) == false)
            {
                throw new NotSupportedException("The plataform does not support the specified Render target Combination for Deferred Rendering, check the logs for more info");
            }

            if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.Single, DepthFormat.Depth24Stencil8, ginfo.UseMipMap, ginfo.MultiSample) == false)
            {
                ActiveLogger.LogMessage("Shadow can behave strange, you dont have the minimum requirements", LogLevel.Warning);
            }


            deferredGBuffer.LoadContent(manager, ginfo, factory, desc.BackGroundColor, desc.UseFloatingBufferForLightMap);
            deferredLightMap.LoadContent(manager, ginfo, factory, desc.CullPointLight, desc.UseFloatingBufferForLightMap);
            deferredFinalCombination.LoadContent(manager, ginfo, factory, desc.UseFloatingBufferForLightMap, desc.ExtraForwardPass);


            if (desc.UseFloatingBufferForLightMap)
            {
                target  = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample);
                target2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample);
            }
            else
            {
                target  = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample);
                target2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample);
            }

            PostEffectTarget = target;
            halfWidth        = ginfo.Viewport.Width / 2;
            halfHeight       = ginfo.Viewport.Height / 2;
            restoreDepth     = new RestoreDepth(desc.UseFloatingBufferForLightMap, manager, factory, ginfo);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Removes the sound emitter.
        /// </summary>
        /// <param name="em">The em.</param>
        public virtual void RemoveSoundEmitter(ISoundEmitter2D em)
        {
            if (em == null)
            {
                ActiveLogger.LogMessage("Emitter is Null " + em.ToString(), LogLevel.RecoverableError);
                return;
            }
            em.Stop();
            bool resp = SoundEmiters2D.Remove(em);

            if (!resp)
            {
                ActiveLogger.LogMessage("Emitter not found: " + em.ToString(), LogLevel.Warning);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Adds an object to the world.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <returns></returns>
        public virtual void AddObject(I2DObject obj)
        {
            if (obj == null)
            {
                ActiveLogger.LogMessage("Cant add null obj", LogLevel.RecoverableError);
                return;
            }

            EntityMapper.getInstance().AddEntity(obj);
            obj.Material.Initialization(GraphicsInfo, GraphicsFactory, obj);
            PhysicWorld.AddObject(obj.PhysicObject);
            obj.PhysicObject.Owner = obj;
            Objects.Add(obj);
            culler.onObjectAdded(obj);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Adds the sound emitter.
        /// </summary>
        /// <param name="em">The em.</param>
        /// <param name="play">if set to <c>true</c> [play].</param>
        public virtual void AddSoundEmitter(ISoundEmitter3D em, bool play = false)
        {
            if (em == null)
            {
                ActiveLogger.LogMessage("Emitter is Null " + em.ToString(), LogLevel.RecoverableError);
                return;
            }

            SoundEmiters3D.Add(em);
            em.Apply3D();
            if (play)
            {
                em.Play();
            }
        }
Ejemplo n.º 11
0
 public Texture2D this[GBufferTypes type]
 {
     get
     {
         if (type == GBufferTypes.FINALIMAGE)
         {
             return(this.target);
         }
         else
         {
             ActiveLogger.LogMessage("Wrong Image Type requested", LogLevel.FatalError);
             throw new Exception("wrong type");
         }
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Adds one post effect.
 /// </summary>
 /// <param name="postEffect">The post effect.</param>
 public virtual void AddPostEffect(IPostEffect postEffect)
 {
     System.Diagnostics.Debug.Assert(postEffect != null);
     if ((postEffect.PostEffectType & PostEffectType) != PostEffectType)
     {
         ActiveLogger.LogMessage("Trying to add a wrong post effect for this Render Technich, pls check if the PostEffectType of the IPostEffect is All or " + PostEffectType + ", The engine is ignoring this operation", LogLevel.RecoverableError);
     }
     else
     {
         if (ginfo != null && factory != null)
         {
             postEffect.Init(ginfo, factory);
         }
         PostEffects.Push(postEffect);
         postEffect.tech = this;
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextureInformation"/> class.
        /// </summary>
        /// <param name="isinternal">if set to <c>true</c> [isinternal].</param>
        /// <param name="factory">The factory.</param>
        /// <param name="diffuseTextureName">Name of the diffuse texture.</param>
        /// <param name="bumpTextureName">Name of the bump texture.</param>
        /// <param name="specularTextureName">Name of the specular texture.</param>
        /// <param name="glowTextureName">Name of the glow texture.</param>
        public TextureInformation(bool isinternal, GraphicFactory factory, String diffuseTextureName = null, String bumpTextureName = null, String specularTextureName = null, String glowTextureName = null)
        {
            isDisposed      = false;
            this.isInternal = isinternal;

            if (factory == null)
            {
                ActiveLogger.LogMessage("Factory Cannot Be null", LogLevel.FatalError);
                throw new Exception("Factory Cannot Be null");
            }

            this._diffuseName  = diffuseTextureName;
            this._specularName = specularTextureName;
            this._bumpName     = bumpTextureName;
            this._glowName     = glowTextureName;
            this.factory       = factory;
        }
Ejemplo n.º 14
0
        public override void RemoveObject(IObject obj)
        {
            if (obj == null)
            {
                ActiveLogger.LogMessage("Cant remove with null obj", LogLevel.RecoverableError);
                return;
            }
            obj.RemoveThisObject();
            EntityMapper.getInstance().RemoveEntity(obj);
            PhysicWorld.RemoveObject(obj.PhysicObject);
            bool resp = Objects.Remove(obj);

            if (!resp)
            {
                ActiveLogger.LogMessage("Cant remove (not found) obj: " + obj.Name, LogLevel.RecoverableError);
            }
        }
        public override void  Initialize(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, IObject obj)
        {
            base.Initialize(ginfo, factory, obj);
            effect = factory.GetEffect("Water", true, true);
            normal = factory.GetTexture2D("waves2", true);
            //effect.Parameters["tNormalMap"].SetValue(factory.GetTexture2D("waves2",true));

            if (String.IsNullOrEmpty(TexureName) && environmentTexture == null)
            {
                ActiveLogger.LogMessage("WaterModel: TextCubeName cannot be null/empty", LogLevel.FatalError);
                throw new Exception("WaterModel: TextCubeName cannot be null/empty");
            }
            if (environmentTexture == null)
            {
                environmentTexture = factory.GetTextureCube(TexureName);
            }
        }
        /// <summary>
        /// Determines whether [This Audio Player has] [the specified sound effect name].
        /// </summary>
        /// <param name="soundEffectName">Name of the sound effect.</param>
        /// <returns>
        ///   <c>true</c> if [has the specified sound effect] otherwise, <c>false</c>.
        /// </returns>
        public bool HasSoundEffect(String soundEffectName)
        {
            if (String.IsNullOrEmpty(soundEffectName))
            {
                ActiveLogger.LogMessage("Bad sound effect name (null/empty) on GetSound(), returning false", LogLevel.Warning);
                return(false);
            }

            if (musics.ContainsKey(soundEffectName))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 17
0
        private void onfinished(IAsyncResult ar)
        {
            if (ar.IsCompleted == false)
            {
                ActiveLogger.LogMessage("Thread finished with errors " + ar.ToString(), LogLevel.RecoverableError);
                return;
            }

            ITask task = ar.AsyncState as ITask;

            System.Diagnostics.Debug.Assert(task != null);

            lock (finished)
            {
                finished.Add(task);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Starts the task.
        /// </summary>
        /// <param name="task">The task.</param>
        public void StartTask(ITask task)
        {
#if !WINDOWS_PHONE
            Task t = new Task(task.Process);
            if (task.TaskEndType == TaskEndType.INSTANT)
            {
                t.BeginInvoke(new AsyncCallback(task.Result), null);
            }
            else if (task.TaskEndType == TaskEndType.ON_NEXT_UPDATE)
            {
                t.BeginInvoke(new AsyncCallback(onfinished), task);
            }
#else
            Worker worker = new Worker();
            worker.DoWork += new System.ComponentModel.DoWorkEventHandler(
                (a, b) => task.Process()
                );

            if (task.TaskEndType == TaskEndType.INSTANT)
            {
                worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(
                    (a, b) => task.Result()
                    );
            }
            else if (task.TaskEndType == TaskEndType.ON_NEXT_UPDATE)
            {
                worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(
                    (a, b) =>
                {
                    if (b.Error != null)
                    {
                        ActiveLogger.LogMessage("Thread finished with errors " + b.Error.ToString(), LogLevel.RecoverableError);
                        return;
                    }
                    lock (finished)
                    {
                        finished.Add(task);
                    }
                }
                    );
            }

            worker.RunWorkerAsync();
#endif
        }
        /// <summary>
        /// Removes the effect from repository.
        /// </summary>
        /// <param name="soundEffectName">Name of the sound effect.</param>
        public void RemoveSoundFromRepository(string soundEffectName)
        {
            System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(soundEffectName));
            if (String.IsNullOrEmpty(soundEffectName))
            {
                ActiveLogger.LogMessage("Bad sound effect name (null/empty), not removing the sound", LogLevel.Warning);
                return;
            }

            if (musics.ContainsKey(soundEffectName))
            {
                musics.Remove(soundEffectName);
            }
            else
            {
                ActiveLogger.LogMessage("Sound not found on repo: " + soundEffectName, LogLevel.Warning);
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Sets the bilboard instances.
 /// </summary>
 /// <param name="instances">The instances.</param>
 public void SetBilboardInstances(BilboardInstance[] instances)
 {
     if (instances.Count() < dynamicBufferSize)
     {
         this.instances = instances;
         BatchInformations[0][0].InstanceCount = instances.Count();
         BatchInformations[0][0].InstancedVertexBuffer.SetData(instances);
     }
     else
     {
         ActiveLogger.LogMessage("Calling SetBilboardInstances with different BilboardInstance size is not recomended, lot of performance penalty here", LogLevel.Warning);
         this.instances = instances;
         VertexBuffer InstancedvertexBufferS = factory.CreateDynamicVertexBuffer(vd, instances.Count(), BufferUsage.WriteOnly);
         InstancedvertexBufferS.SetData(instances);
         BatchInformations[0][0].InstanceCount         = instances.Count();
         BatchInformations[0][0].InstancedVertexBuffer = InstancedvertexBufferS;
     }
 }
        /// <summary>
        /// Gets the sound effect instance.
        /// The SimpleSoundEffect MUST BE ALREADY IN THE REPO !!!
        /// TO CREATE A Non SHARED SIMPLESOUNDEFFECT, USE THE SIMPLESOUNDEFFECT CONSTRUTOR.
        /// </summary>
        /// <param name="soundEffectName">Name of the sound effect.</param>
        /// <returns></returns>
        public SimpleSoundEffect GetSoundEffectInstance(String soundEffectName)
        {
            if (String.IsNullOrEmpty(soundEffectName))
            {
                ActiveLogger.LogMessage("Bad sound effect name (null/empty) on GetSound(), returning null", LogLevel.Warning);
                return(null);
            }

            if (musics.ContainsKey(soundEffectName))
            {
                return(musics[soundEffectName]);
            }
            else
            {
                ActiveLogger.LogMessage("Sound Not Found in this Repo", LogLevel.Warning);
                return(null);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DeferredCustomShader"/> class.
        /// </summary>
        /// <param name="useGlow">if set to <c>true</c> [use glow].</param>
        /// <param name="useBump">if set to <c>true</c> [use bump].</param>
        /// <param name="useSpecular">if set to <c>true</c> [use specular].</param>
        /// <param name="useParalax">if set to <c>true</c> [use paralax].</param>
        /// /// <param name="useAmbientCubeMap">if set to <c>true</c> [use AmbientCubeMap].</param>
        /// <param name="specularIntensity">The specular intensity.</param>
        /// <param name="specularPower">The specular power.</param>
        /// <param name="ambientCubeMapScale ">The ambientCubeMap Scale.</param>
        public DeferredCustomShader(bool useGlow, bool useBump, bool useSpecular, bool useParalax, bool useAmbientCubeMap = false, float specularIntensity = 0, float specularPower = 0, float ambientCubeMapScale = 0.1f)
        {
            if (specularPower < 0)
            {
                ActiveLogger.LogMessage("specularPower cannot be negative, setting to 0", LogLevel.RecoverableError);
                specularPower = 0;
            }
            if (specularIntensity < 0)
            {
                ActiveLogger.LogMessage("specularIntensity cannot be negative, setting to 0", LogLevel.RecoverableError);
                specularIntensity = 0;
            }

            if (ambientCubeMapScale < 0)
            {
                ActiveLogger.LogMessage("ambientCubeMapScale cannot be negative, setting to 0.1f", LogLevel.RecoverableError);
                ambientCubeMapScale = 0.1f;
            }

            this.AmbientCubeMapScale = ambientCubeMapScale;
            this.effect               = "AllBuffer";
            this.specularIntensity    = specularIntensity;
            this.specularPower        = specularPower;
            this.useGlow              = useGlow;
            this.useSpecular          = useSpecular;
            this.useBump              = useBump;
            this.useParalax           = useParalax;
            specularPowerMapScale     = 1;
            specularIntensityMapScale = 1;

            if (useAmbientCubeMap == true && useGlow == true)
            {
                ActiveLogger.LogMessage("Cant enable GLow and AmbientCubeMap together, AmbientCubeMap being disabled", LogLevel.RecoverableError);
                useAmbientCubeMap = false;
            }

            this.UseAmbientCubeMap = useAmbientCubeMap;

            if (useParalax == true && useBump == false)
            {
                ActiveLogger.LogMessage("Are you sure you will use only Paralax without BUMP, the paralax expects bump", LogLevel.Warning);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Sets the cube texture.
        /// </summary>
        /// <param name="tex">The tex.</param>
        /// <param name="type">The type.</param>
        public void SetCubeTexture(TextureCube tex, TextureType type)
        {
            switch (type)
            {
            case TextureType.AMBIENT_CUBE_MAP:
                this._ambientName = "CUSTOM";
                this.ambient      = tex;
                break;

            case TextureType.ENVIRONMENT:
                this._reflectionName = "CUSTOM";
                this.reflection      = tex;
                break;

            default:
                ActiveLogger.LogMessage("Setting Invalid Type of Texture", LogLevel.RecoverableError);
                break;
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Removes the trigger.
        /// </summary>
        /// <param name="trigger">The trigger.</param>
        public virtual void RemoveTrigger(ITrigger trigger)
        {
            if (trigger == null)
            {
                ActiveLogger.LogMessage("Cant Remove Null Trigger", LogLevel.RecoverableError);
                return;
            }
            bool resp = Triggers.Remove(trigger);

            if (!resp)
            {
                ActiveLogger.LogMessage("Trigger not found: " + trigger.Name, LogLevel.Warning);
            }

            if (trigger.GhostObject != null)
            {
                PhysicWorld.RemoveObject(trigger.GhostObject);
            }
        }
 /// <summary>
 /// Removes the particle system.
 /// </summary>
 /// <param name="particleSystem">The particle system.</param>
 public override void RemoveParticleSystem(IParticleSystem particleSystem)
 {
     System.Diagnostics.Debug.Assert(particleSystem != null, "Particle System cannot be null");
     if (particleSystem is DPFSParticleSystem)
     {
         if (ParticleSystem.ContainsKey(particleSystem.Name))
         {
             manager.RemoveParticleSystem((particleSystem as DPFSParticleSystem).IDPSFParticleSystem);
         }
         else
         {
             ActiveLogger.LogMessage("Particle System do not Exist", LogLevel.Warning);
         }
     }
     else
     {
         ActiveLogger.LogMessage("You can only remove DPFS particles in this manager, operation ignored", LogLevel.RecoverableError);
     }
 }
Ejemplo n.º 26
0
        public Microsoft.Xna.Framework.Graphics.Texture2D this[GBufferTypes type]
        {
            get {
                switch (type)
                {
                case GBufferTypes.DEPH:
                    return(depthRT);

                case GBufferTypes.NORMAL:
                    return(normalRT);

                case GBufferTypes.Extra1:
                    return(lightOclusionRT);

                default:
                    ActiveLogger.LogMessage("Invalid Buffer requested", LogLevel.FatalError);
                    throw new Exception("This GBUFFER dont use this Buffer Type");
                }
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Adds the trigger.
        /// </summary>
        /// <param name="trigger">The trigger.</param>
        public virtual void AddTrigger(ITrigger trigger)
        {
            if (trigger == null)
            {
                ActiveLogger.LogMessage("Cant Add null Trigger", LogLevel.RecoverableError);
                return;
            }

            if (String.IsNullOrEmpty(trigger.Name))
            {
                ActiveLogger.LogMessage("Trigger with no Name", LogLevel.Warning);
            }

            Triggers.Add(trigger);

            if (trigger.GhostObject != null)
            {
                PhysicWorld.AddObject(trigger.GhostObject);
            }
        }
        /// <summary>
        /// Adds the and initialize particle system.
        /// </summary>
        /// <param name="particleSystem">The particle system.</param>
        public override void AddAndInitializeParticleSystem(IParticleSystem particleSystem)
        {
            System.Diagnostics.Debug.Assert(particleSystem != null, "Particle System cannot be null");

            if (ParticleSystem.ContainsKey(particleSystem.Name))
            {
                ActiveLogger.LogMessage("Particle System already exist, overwriting", LogLevel.Warning);
            }
            ParticleSystem[particleSystem.Name] = particleSystem as DPFSParticleSystem;
            if (particleSystem is DPFSParticleSystem)
            {
                DPFSParticleSystem ps = particleSystem as DPFSParticleSystem;
                ps.IDPSFParticleSystem.AutoInitialize(GraphicFactory.device, GraphicFactory.contentManager.ContentManager, GraphicFactory.SpriteBatch);
                manager.AddParticleSystem(ps.IDPSFParticleSystem);
            }
            else
            {
                ActiveLogger.LogMessage("You can only add DPFS particles in this manager, operation ignored", LogLevel.RecoverableError);
            }
        }
Ejemplo n.º 29
0
            protected override void Update(Microsoft.Xna.Framework.GameTime gameTime)
            {
                if (firstTime)
                {
                    bet.InitOrRestart(gameTime);
                    firstTime = false;
                }


                if (bet.hasPassed(gameTime))
                {
                    i += 1;
                    if (i == IScreen.Count)
                    {
                        Environment.Exit(0);
                    }
                    ScreenManager.AddScreen(IScreen[i]);
                    TimePassed.InitOrRestart(gameTime);
                    ActiveLogger.LogMessage("Added Screen: " + IScreen[i].GetType().AssemblyQualifiedName, LogLevel.Info);
                    if (pathToScreenShot != null)
                    {
                        takeScreen = true;
                    }
                }

                if (TimePassed.hasPassed(gameTime))
                {
                    ScreenManager.RemoveScreen(IScreen[i]);
                    bet.InitOrRestart(gameTime);
                    ActiveLogger.LogMessage("Removed Screen: " + IScreen[i].GetType().AssemblyQualifiedName, LogLevel.Info);

                    foreach (var item in contentManager.DumpAssetReferenceCount())
                    {
                        ActiveLogger.LogMessage("Assets Dump: " + item.Key + " : " + item.Value, LogLevel.Info);
                    }

                    System.Diagnostics.Debug.Assert(contentManager.DumpAssetReferenceCount().Count == 0);
                }

                base.Update(gameTime);
            }
Ejemplo n.º 30
0
        /// <summary>
        /// Adds an object to the world.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="InitMaterial">if set to <c>true</c> [init material].</param>
        public virtual void AddObject(IObject obj, bool InitMaterial = true)
        {
            if (obj == null)
            {
                ActiveLogger.LogMessage("Cant add null obj", LogLevel.RecoverableError);
                return;
            }

            EntityMapper.getInstance().AddEntity(obj);
            PhysicWorld.AddObject(obj.PhysicObject);
            obj.PhysicObject.ObjectOwner = obj;
            Objects.Add(obj);
            if (InitMaterial)
            {
                obj.Material.Initialization(graphicsInfo, graphicFactory, obj);
            }
            Culler.onObjectAdded(obj);
            obj.FireOnBeingAdd(this);

            obj.afterAddedToTheWorld();
        }