Exemple #1
0
        public Ennemi(Animate textureAnime, Vector2 position, Hero hero, Map map)
        {
            this.textureAnime = Ressources.GetPerso(Perso.Choisi).ennemiTextureAnime;
            this.texture = Ressources.GetPerso(Perso.Choisi).ennemiTexture;
            this.personnageAnime = Ressources.GetPerso(Perso.Choisi).ennemiAnime;
            this.positionGlobale = position;
            this.positionInitiale = position;
            this.vitesse = hero.vitesse;
            this.vitesseInitiale = hero.vitesse;
            this.container = new Rectangle((int)position.X, (int)position.Y, (int)(textureAnime.Texture.Width / textureAnime.Columns), textureAnime.Texture.Height);
            this.type = TypePerso.Ennemi;
            this.poids = new Vector2(0, hero.poids.Y);
            this.force = Vector2.Zero;
            this.reaction = Vector2.Zero;
            this.map = map;
            this.currentObjet = new Objet();
            this.hero = hero;

            ACDC = new Rectangle(0, 0, texture.Width, texture.Height);

            animate = true;
            dead = false;

            font = Ressources.GetPerso(Perso.Choisi).font;

            #region moteur à particules
            particleComponent = new ParticleComponent(Ressources.Game);
            Ressources.Game.Components.Add(particleComponent);
            Emitter fireEmitter = new Emitter();
            fireEmitter.Active = false;
            fireEmitter.TextureList.Add(Ressources.GetPerso(Perso.Choisi).obstacle);
            fireEmitter.RandomEmissionInterval = new RandomMinMax(50);
            fireEmitter.ParticleLifeTime = 9000;
            fireEmitter.ParticleDirection = new RandomMinMax(270, 300);
            fireEmitter.ParticleSpeed = new RandomMinMax(10, 20); // g modifié le moteur a particule;
            fireEmitter.ParticleRotation = new RandomMinMax(0, 180);
            fireEmitter.RotationSpeed = new RandomMinMax(0.04f);
            fireEmitter.ParticleFader = new ParticleFader(false, true, 30);
            fireEmitter.ParticleScaler = new ParticleScaler(0.2f, 0.18f, 0, 100);
            fireEmitter.Position = new Vector2(400, 650);
            //******piece*********
            Emitter desinté_piece = new Emitter();
            desinté_piece.Active = false;
            desinté_piece.TextureList.Add(Ressources.GetPerso(Perso.Choisi).piece);
            desinté_piece.RandomEmissionInterval = new RandomMinMax(50);
            desinté_piece.ParticleLifeTime = 9000;
            desinté_piece.ParticleDirection = new RandomMinMax(270, 300);
            desinté_piece.ParticleSpeed = new RandomMinMax(10, 20); // g modifié le moteur a particule;
            desinté_piece.ParticleRotation = new RandomMinMax(0, 180);
            desinté_piece.RotationSpeed = new RandomMinMax(0.04f);
            desinté_piece.ParticleFader = new ParticleFader(false, true, 30);
            desinté_piece.ParticleScaler = new ParticleScaler(1.2f, 0.18f, 0, 100);
            desinté_piece.Position = new Vector2(400, 650);
            particleComponent.particleEmitterList.Add(fireEmitter);
            particleComponent.particleEmitterList.Add(desinté_piece);
            #endregion
        }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            ATexture.Load(Content);

            //Particles
            particleComponent.particleEmitterList.Add(
                    new Emitter()
                    {
                        Active = false,
                        TextureList = new List<Texture2D>() {
                  Content.Load<Texture2D>("Particles/flower_orange"),
                  Content.Load<Texture2D>("Particles/flower_green"),
                  Content.Load<Texture2D>("Particles/flower_yellow"),
                  Content.Load<Texture2D>("Particles/flower_purple")
                },
                        RandomEmissionInterval = new RandomMinMax(8.0d),
                        ParticleLifeTime = 2000,
                        ParticleDirection = new RandomMinMax(0, 359),
                        ParticleSpeed = new RandomMinMax(0.1f, 1.0f),
                        ParticleRotation = new RandomMinMax(0, 100),
                        RotationSpeed = new RandomMinMax(0.015f),
                        ParticleFader = new ParticleFader(false, true, 1350),
                        ParticleScaler = new ParticleScaler(false, 0.3f)
                    }
            );

            Emitter testEmitter2 = new Emitter();
            testEmitter2.Active = true;
            testEmitter2.TextureList.Add(Content.Load<Texture2D>("Particles/raindrop"));
            testEmitter2.RandomEmissionInterval = new RandomMinMax(16.0d);
            testEmitter2.ParticleLifeTime = 1000;
            testEmitter2.ParticleDirection = new RandomMinMax(170);
            testEmitter2.ParticleSpeed = new RandomMinMax(10.0f);
            testEmitter2.ParticleRotation = new RandomMinMax(0);
            testEmitter2.RotationSpeed = new RandomMinMax(0f);
            testEmitter2.ParticleFader = new ParticleFader(false, true, 800);
            testEmitter2.ParticleScaler = new ParticleScaler(false, 1.0f);
            testEmitter2.Opacity = 255;

            particleComponent.particleEmitterList.Add(testEmitter2);

            //Fonts.Font1 = Content.Load<SpriteFont>("Menu/Fonts/SpriteFont1");
        }