public Startview(ContentManager _content, Camera _camera, SpriteBatch _spritebatch,BallSimulation _ballsim,GraphicsDeviceManager _graphics) { content = _content; camera = _camera; spritebatch = _spritebatch; ballsim = _ballsim; graphics = _graphics; fieldsize = camera.ReturnFieldsize(); bordersize = camera.ReturnBorder(); rect = new Rectangle(bordersize, bordersize, fieldsize, fieldsize); splittertexture = content.Load<Texture2D>("spark"); smoketexture = content.Load<Texture2D>("smoke"); explosiontexture = content.Load<Texture2D>("explosion"); shockwavetexture = content.Load<Texture2D>("Shockwave"); balltexture = content.Load<Texture2D>("BALL"); deadball = content.Load<Texture2D>("Deadball"); crosshair = content.Load<Texture2D>("Crosshair"); firesound = content.Load<SoundEffect>("fire"); ballcenter = new Vector2(balltexture.Width / 2, balltexture.Height / 2); background = new Texture2D(graphics.GraphicsDevice, 1, 1); background.SetData(new Color[] { Color.Black }); }
public Shockwave(Texture2D _shockwavetexture, SpriteBatch _spritebatch, Camera _camera,float _scale, Vector2 _startpos) { camera = _camera; spritebatch = _spritebatch; shockwavetexture = _shockwavetexture; currentPos = _startpos; shockwavemaxsize = _scale; }
public SplitterSystem(Texture2D spark,SpriteBatch _spritebatch,Camera _camera,float _scale,Vector2 _startlocation) { spritebatch = _spritebatch; camera = _camera; scale = _scale; startpos = _startlocation; while(particles.Count <maxparticles) { particles.Add(new SplitterParticle(spark, rand, spritebatch, camera, scale, startpos, lifetime)); } }
public Explosion(Texture2D _explosiontexture,SpriteBatch _spritebatch,Camera _camera,float _scale,Vector2 _startpos) { camera = _camera; spritebatch = _spritebatch; explosion = _explosiontexture; currentPos = _startpos; scale = _scale; timeElapsed = 0; explosionwidth = _explosiontexture.Width / numframesX; explosionheight = _explosiontexture.Height / numframesY; }
public Smokesystem(Texture2D _smokeTexture, SpriteBatch _spritebatch,Camera _camera,float _scale,Vector2 _startlocation) { smoketexture = _smokeTexture; spritebatch = _spritebatch; camera = _camera; scale = _scale; startlocation = _startlocation; if (particles.Count < numberofsmokes) { particles.Add(new Smokeparticle(smoketexture, rand, lifetimeofsmoke,startlocation,scale)); } }
public Explosionview(Camera _camera,SpriteBatch _spritebatch,Vector2 _startpos, Texture2D _splittertexture,Texture2D _smoketexture,Texture2D _explosiontexture,Texture2D _shockwavetexture) { camera = _camera; spritebatch = _spritebatch; startpos = _startpos; splittertexture = _splittertexture; smoketexture = _smoketexture; explosiontexture = _explosiontexture; shockwavetexture = _shockwavetexture; splittersystem = new SplitterSystem(splittertexture, spritebatch, camera, scale, startpos); smokesystem = new Smokesystem(smoketexture, spritebatch, camera,scale, startpos); explosion = new Explosion(explosiontexture, spritebatch, camera, scale, startpos); shockwave = new Shockwave(shockwavetexture, spritebatch, camera,scale, startpos); }
public SplitterParticle(Texture2D _spark, Random _rand, SpriteBatch _spritebatch, Camera _camera, float _scale, Vector2 _startpos, float _lifetime) { spark = _spark; rand = _rand; spritebatch = _spritebatch; camera = _camera; scale = _scale; startpos = _startpos; lifetime = _lifetime; randomdirection = new Vector2((float)rand.NextDouble() - 0.5f, (float)rand.NextDouble() - 0.7f); //normalize to get it spherical vector with length 1.0 randomdirection.Normalize(); randomdirection = randomdirection * ((float)rand.NextDouble() * maxspeed); velocity = randomdirection *scale; fade = 1; color = new Color(fade, fade, fade, fade); }
public void Draw(SpriteBatch spritebatch, Camera camera) { float scale = camera.Scale(particlesize,smokecloud.Width); spritebatch.Draw(smokecloud, camera.Converttovisualcoords(currentpos, scale), null, color, rotation, randomdirection, scale, SpriteEffects.None, 0.8f); }