Esempio n. 1
0
        public SmokeSystem(Vector2 SecPerSpawn, Vector2 SpawnDirection, Vector2 SpawnNoiseAngle,
                            Vector2 StartLife, Vector2 StartScale, Vector2 EndScale, Color StartColor1,
                            Color StartColor2, Color EndColor1, Color EndColor2, Vector2 StartSpeed,
                            Vector2 EndSpeed, int Budget, Vector2 RelPosition, Texture2D smokeParticleSprite,
                            Random random, ParticleSystem particleSystem)
        {
            this.smokeSecPerSpawn = SecPerSpawn;
            this.smokeSpawnDirection = SpawnDirection;
            this.smokeSpawnNoiseAngle = SpawnNoiseAngle;
            this.smokeStartLife = StartLife;
            this.smokeStartScale = StartScale;
            this.smokeEndScale = EndScale;
            this.smokeStartColor1 = StartColor1;
            this.smokeStartColor2 = StartColor2;
            this.smokeEndColor1 = EndColor1;
            this.smokeEndColor2 = EndColor2;
            this.smokeStartSpeed = StartSpeed;
            this.smokeEndSpeed = EndSpeed;
            this.maxSmokeParticle = Budget;
            this.smokeRelPosition = RelPosition;
            this.smokeParticleSprite = smokeParticleSprite;
            this.random = random;
            this.particleSystem = particleSystem;

            activeSmokeParticles = new LinkedList<SmokeParticle>();

            this.spawnNextParticle = SmokeCalculate.smokeyCalc(smokeSecPerSpawn.X, smokeSecPerSpawn.Y, random.NextDouble());
            this.lastParticle = 0.0f;
        }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            spriteBatch = new SpriteBatch(this.GraphicsDevice);
            smokeTexture = this.Content.Load<Texture2D>("smokePic");
            particleSystem = new ParticleSystem(new Vector2(250, 210)); // // Cordination of smokeSpawn - Position
            particleSystem.addParticle(new Vector2(0.02f, 0.015f), // density
                                        new Vector2(1, -1), new Vector2(0.1f * MathHelper.Pi, 0.25f * -MathHelper.Pi), // rotate
                                        new Vector2(0.5f, 0.75f),
                                        new Vector2(20, 120), new Vector2(225, 575f), // spread
                                        Color.Orange, Color.Black, new Color(Color.Black, 0), new Color(Color.Black, 0),
                                        new Vector2(800, 600), new Vector2(100, 160), 10000, Vector2.Zero, smokeTexture);

            base.Initialize();
        }
Esempio n. 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            spriteBatch = new SpriteBatch(this.GraphicsDevice);
            smokeTexture = this.Content.Load<Texture2D>("smokePic");
            particleSystem = new ParticleSystem(new Vector2(400, 300));
            particleSystem.addParticle(new Vector2(0.01f, 0.015f),
                                        new Vector2(0, -1), new Vector2(0.1f * MathHelper.Pi, 0.1f * -MathHelper.Pi),
                                        new Vector2(0.5f, 0.75f),
                                        new Vector2(60, 70), new Vector2(15, 15f),
                                        Color.Orange, Color.Black, new Color(Color.Black, 0), new Color(Color.Black, 0),
                                        new Vector2(400, 500), new Vector2(100, 120), 1000, Vector2.Zero, smokeTexture);

            base.Initialize();
        }