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); }
private void ExplosionDrawer(object o, PaintEventArgs e) { //size of the explosion int explosionWidth = 40; Image explosion; Explosion exp = o as Explosion; //make size of explosion random //int randNum = 1; System.Random rand = new System.Random(); //randNum = rand.Next(1, 4); explosionWidth = rand.Next(25, 45); switch (exp.GetCount()) { case 1: case 2: case 3: case 4: case 5: explosion = explosionFire; break; case 6: case 7: case 8: case 9: case 10: explosion = explosionFire3; break; case 11: case 12: case 13: case 14: case 15: explosion = explosionFire2; break; case 16: case 17: case 18: case 19: case 20: explosion = explosionFire; break; case 21: case 22: case 23: case 24: case 25: explosion = explosionFire3; break; case 26: case 27: case 28: case 29: case 30: explosion = explosionFire4; break; case 31: case 32: case 33: case 34: case 35: explosion = explosionSmokeForming1; break; case 36: case 37: case 38: case 39: case 40: explosion = explosionSmokeForming2; break; case 41: case 42: case 43: case 44: case 45: explosion = explosionSmokeForming3; break; case 46: case 47: case 48: case 49: case 50: explosion = explosionSmokeForming4; break; case 51: case 52: case 53: case 54: case 55: explosion = explosionSmokeForming5; break; case 56: case 57: case 58: case 59: case 60: explosion = explosionSmoke1; break; case 61: case 62: case 63: case 64: case 65: explosion = explosionSmoke2; break; case 66: case 67: case 68: case 69: case 70: explosion = explosionSmoke3; break; case 71: case 72: case 73: case 74: case 75: explosion = explosionSmoke4; break; case 76: case 77: case 78: case 79: case 80: explosion = explosionSmoke5; break; case 81: case 82: case 83: case 84: case 85: explosion = explosionSmoke6; break; case 86: case 87: case 88: case 89: case 90: explosion = explosionSmoke7; break; case 91: case 92: case 93: case 94: case 95: explosion = explosionSmoke8; break; case 96: case 97: case 98: case 99: case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: explosion = explosionSmoke9; break; default: explosion = explosionFire3; break; } Rectangle r = new Rectangle(-(explosionWidth / 2), -(explosionWidth / 2), explosionWidth, explosionWidth); e.Graphics.DrawImage(explosion, r); }