protected override void LoadContent() { _taps = new List <Vector2>(); // Create a new SpriteBatch, which can be used to draw textures. SpriteBatch = new SpriteBatch(GraphicsDevice); GameData = new GamePersistance <GameData>(this); Pixel = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color); Pixel.SetData(new[] { Color.White }); Textures.LoadContent(Content); Fonts.LoadContent(Content); ParticleSystem = new ParticleEngine(); ParticleColor = Color.Black; MouseInput = new MouseInput(); TouchInput = new TouchInput(); UnifiedInput = new UnifiedInput(this); KeyboardInput = new KeyboardInput(this); UnifiedInput.MoveListeners.Add((v) => { ParticleSystem.Add(new Emitter(v, new TimeSpan(0, 0, 0, 1), e => ParticleFactory.GenerateParticle(e, Textures.ParticleStar, ParticleColor), 5, 20)); }); UnifiedInput.TapListeners.Add(OnTap); UnifiedInput.DraggedListeners.Add(OnDragged); //Branding.BackgroundColor = Color.Red; IsMouseVisible = false; BackGroundTune = Game.Audio.Play(Cues.Background, AudioChannels.Music, true); }
public void AddFireWorks(Vector2 point, Color color, float size) { LastFlash = color; Audio.Play(Sounds.Explode); Flash.Reset(); if (ParticleModifiers.Count == 0) { ParticleEngine.Add(new Emitter(point, TimeSpan.FromMilliseconds((int)(200f * (size * size))), e => ParticleFactory.GenerateParticle(e, Textures.ParticleFlowerBurst, Color.Lerp(color, Color.White, size), color), (int)Math.Max(3000f * size, 500), (int)(250 * size))); } else { var p = ParticleModifiers.ToArray(); foreach (var t in p) { if (t.GetType() == typeof(CircularPattern)) { ((CircularPattern)t).Radius = ModifierCircRectSize * size; } else if (t.GetType() == typeof(RectanglePattern)) { ((RectanglePattern)t).Size = new Vector2(ModifierCircRectSize * 2f, ModifierCircRectSize * 2f) * size; } else if (t.GetType() == typeof(RandomEmmisionRate)) { ((RandomEmmisionRate)t).randomness = ModifierEmissionRate * size; } else if (t.GetType() == typeof(ConcentriclPattern)) { ((ConcentriclPattern)t).Radius = ModifierConcentricSize * size; } } ParticleEngine.Add(new Emitter(point, TimeSpan.FromMilliseconds((int)(200f * (size * size))), e => ParticleFactory.GenerateParticle(e, Textures.ParticleFlowerBurst, Color.Lerp(color, Color.White, size), color), (int)Math.Max(8000f * size, 500), (int)(500f * size), p)); } }