public ParticleEmitterTimeline(BinaryReader BR, ContentManager Content) : base(BR, TimelineType) { Matrix view = Matrix.Identity; Matrix Projection = Matrix.CreateOrthographicOffCenter(0, 800, 600, 0, 0, 1); Matrix HalfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0); Projection = view * (HalfPixelOffset * Projection); Particle3DSample.ParticleSettings ParticleSettings = new Particle3DSample.ParticleSettings(); ParticleSettings.TextureName = BR.ReadString(); ParticleSettings.MaxParticles = 20000; ParticleSettings.MinScale = new Vector2(1, 1); ParticleSettings.DurationInSeconds = 1d; ParticleSettings.Gravity = new Vector2(0, 0); ParticleSettings.NumberOfImages = 16; ParticleSettings.BlendState = BlendState.AlphaBlend; ParticleSettings.StartingAlpha = 0.7f; ParticleSettings.EndAlpha = 0.1f; _SpawnOffset = new Vector2(BR.ReadSingle(), BR.ReadSingle()); _SpawnOffsetRandom = new Vector2(BR.ReadSingle(), BR.ReadSingle()); SpawnSpeed = new Vector2(BR.ReadSingle(), BR.ReadSingle()); SpawnSpeedRandom = new Vector2(BR.ReadSingle(), BR.ReadSingle()); ParticlesPerSeconds = BR.ReadDouble(); ParticleSettings.DurationInSeconds = BR.ReadSingle(); float SpeedMultiplier = BR.ReadSingle(); ParticleSettings.NumberOfImages = BR.ReadInt32(); ParticleSettings.Gravity = new Vector2(BR.ReadSingle(), BR.ReadSingle()); Vector2 Size = new Vector2(BR.ReadSingle(), BR.ReadSingle()); ParticleSettings.MinScale = new Vector2(BR.ReadSingle(), BR.ReadSingle()); ParticleSettings.StartingAlpha = BR.ReadSingle(); ParticleSettings.EndAlpha = BR.ReadSingle(); _ParticleBlendState = (ParticleBlendStates)BR.ReadByte(); TimeBetweenEachParticle = 1 / ParticlesPerSeconds; ParticleSystem = new Particle3DSample.ParticleSystem(ParticleSettings); ParticleSystem.LoadContent(Content, GameScreen.GraphicsDevice, Projection); this.SpeedMultiplier = SpeedMultiplier; this.Size = Size; UpdateSize(); int DicAnimationSpriteKeyFrameCount = BR.ReadInt32(); for (int E = 0; E < DicAnimationSpriteKeyFrameCount; E++) { int Key = BR.ReadInt32(); VisibleAnimationObjectKeyFrame NewAnimatedBitmapKeyFrame = new VisibleAnimationObjectKeyFrame(BR); DicAnimationKeyFrame.Add(Key, NewAnimatedBitmapKeyFrame); } Origin = new Point(Width / 2, Height / 2); }
public ParticleEmitterTimeline() : base(TimelineType, "New Particle Emitter") { Origin = new Point(Width / 2, Height / 2); _ParticleBlendState = ParticleBlendStates.Additive; }