Esempio n. 1
0
        /// <summary>
        /// Initialize the particle system.
        /// </summary>
        /// <param name="content">The content manager that owns the texture.</param>
        public virtual void Initialize(ContentManager content)
        {
            // calculate the release rate
            releaseRate = 1.0f / (float)particlesPerSecond;

            // create the cache
            particles = new ParticleCache(particleCount);

            // load the texture
            try
            {
                texture = content.Load <Texture2D>(textureName);
            }
            catch (ContentLoadException)
            {
                texture = content.Load <Texture2D>("Textures/Particles/defaultParticle");
            }

            // calculate the origin on the texture
            textureOrigin = new Vector2(texture.Width / 2f, texture.Height / 2f);

            // allow us to start updating and drawing
            active = true;
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize the particle system.
        /// </summary>
        /// <param name="content">The content manager that owns the texture.</param>
        public virtual void Initialize(ContentManager content)
        {
            // calculate the release rate
            releaseRate = 1.0f / (float)particlesPerSecond;

            // create the cache
            particles = new ParticleCache(particleCount);

            // load the texture
            try
            {
                texture = content.Load<Texture2D>(textureName);
            }
            catch (ContentLoadException)
            {
                texture = content.Load<Texture2D>("Textures/Particles/defaultParticle");
            }

            // calculate the origin on the texture
            textureOrigin = new Vector2(texture.Width / 2f, texture.Height / 2f);
            
            // allow us to start updating and drawing
            active = true;
        }