/// <summary>
        /// Constructs a new particle emitter object.
        /// </summary>
        public ParticleEmitter(ParticleSystem particleSystem,
                               float particlesPerSecond, Vector3 initialPosition)
        {
            this.particleSystem = particleSystem;

            timeBetweenParticles = 1.0f / particlesPerSecond;

            previousPosition = initialPosition;
        }
Пример #2
0
        public override void Initialize()
        {
            camera = (ICamera)Game.Services.GetService(typeof(ICamera));
            renderTargets = (IRenderTargets)Game.Services.GetService(typeof(IRenderTargets));
            postprocessingManager = (IPostprocessingManager)Game.Services.GetService(typeof(IPostprocessingManager));
            collisionManager = (ICollisionManager)Game.Services.GetService(typeof(ICollisionManager));

            view = camera.View;
            projection = camera.Projection;

            for (int i = 0; i < particles.Count(); ++i)
            {
                particles[i] = new ParticleSystem(Game, Game.Content, "Laser");
                particles[i].Initialize();
                particleEmitter[i] = new ParticleEmitter(particles[i], 100, Position);
            }
            base.Initialize();
        }
Пример #3
0
 protected override void LoadContent()
 {
     #if !XBOX
     switch (GameColor)
     {
         case GameColors.Red:
             particles = new ParticleSystem(Game, Game.Content, "RedProjectileSettings");
             break;
         case GameColors.Blue:
             particles = new ParticleSystem(Game, Game.Content, "BlueProjectileSettings");
             break;
         case GameColors.Green:
             particles = new ParticleSystem(Game, Game.Content, "GreenProjectileSettings");
             break;
         case GameColors.Yellow:
             particles = new ParticleSystem(Game, Game.Content, "YellowProjectileSettings");
             break;
     }
     particles.Initialize();
     particleEmitter = new ParticleEmitter(particles, 10, Position);
     #endif
     //model = Game.Content.Load<Model>("sphere");
     model = Game.Content.Load<Model>("Sphere2");
     base.LoadContent();
 }
Пример #4
0
 public override void Initialize()
 {
     collisionManager = (ICollisionManager)Game.Services.GetService(typeof(ICollisionManager));
     camera = (ICamera)Game.Services.GetService(typeof(ICamera));
     player = (IPlayer)Game.Services.GetService(typeof(IPlayer));
     particleSystem = new ParticleSystem(Game, Game.Content, "ExplosionSettings");
     particleSystem.Initialize();
     particleSystem.On = false;
     particleEmitter = new ParticleEmitter(particleSystem, 100, position);
     base.Initialize();
 }