| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #region File Description
- //-----------------------------------------------------------------------------
- // FireParticleSystem.cs
- //
- // Microsoft XNA Community Game Platform
- // Copyright (C) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- #endregion
- #region Using Statements
- using System;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Content;
- using Microsoft.Xna.Framework.Graphics;
- #endregion
- namespace Particle3DSample
- {
- /// <summary>
- /// Custom particle system for creating a flame effect.
- /// </summary>
- class FireParticleSystem : ParticleSystem
- {
- public FireParticleSystem(Game game, ContentManager content)
- : base(game, content)
- { }
- protected override void InitializeSettings(ParticleSettings settings)
- {
- settings.TextureName = "fire";
- settings.MaxParticles = 2400;
- settings.Duration = TimeSpan.FromSeconds(2);
- settings.DurationRandomness = 1;
- settings.MinHorizontalVelocity = 0;
- settings.MaxHorizontalVelocity = 15;
- settings.MinVerticalVelocity = -10;
- settings.MaxVerticalVelocity = 10;
- // Set gravity upside down, so the flames will 'fall' upward.
- settings.Gravity = new Vector3(0, 15, 0);
- settings.MinColor = new Color(255, 255, 255, 10);
- settings.MaxColor = new Color(255, 255, 255, 40);
- settings.MinStartSize = 5;
- settings.MaxStartSize = 10;
- settings.MinEndSize = 10;
- settings.MaxEndSize = 40;
- // Use additive blending.
- settings.BlendState = BlendState.Additive;
- }
- }
- }
|