Beispiel #1
0
        private void AddExplosion(Vector2 explosionPos, int numberOfParticles, float size, float maxAge, GameTime gameTime)
        {
            _explosion.AddExplosion(explosionPos, numberOfParticles, size, maxAge, gameTime);

            var rotation = (float)_randomizer.Next(1, 10);
            var mat      =
                Matrix.CreateTranslation(-_textureCenter.ExplosionTexture.Width / 2,
                                         -_textureCenter.ExplosionTexture.Height / 2, 0) * Matrix.CreateRotationZ(rotation) *
                Matrix.CreateScale(terrainExplosionSize / (float)_textureCenter.ExplosionTexture.Width * 2.0f) *
                Matrix.CreateTranslation(explosionPos.X, explosionPos.Y, 0);

            AddCrater(_textureCenter.ExplosionColorArray, mat);

            // set the new place of the players
            foreach (var carriage in _carriages)
            {
                carriage.Position.Y = _terrainContour[(int)carriage.Position.X];
            }

            FlattenTerrainBelowPlayers();
            CreateForeground();
        }