コード例 #1
0
        public static OverworldExplosion GenerateOverworldExplosion(Game1 game, Sprite spriteSheet, GameObjectOverworld source)
        {
            float size             = 20;
            float fragmentSpeed    = 0.4f;
            int   lifeTime         = 15;
            int   nbrParticlesBase = 50;

            OverworldExplosion tempExplosion = new OverworldExplosion(game, spriteSheet);

            int nbrParticles = random.Next(nbrParticlesBase, nbrParticlesBase + (int)(nbrParticlesBase * 0.5));

            tempExplosion.GenerateAbsoluteExplosion(game, spriteSheet, source, nbrParticles, size,
                                                    randomDir: true, speed: 0, fragmentDur: lifeTime, fragmentSpeed: fragmentSpeed);

            return(tempExplosion);
        }
コード例 #2
0
        public static OverworldExplosion GenerateSpaceDuckExplosion(Game1 game, Sprite spriteSheet, GameObjectOverworld source)
        {
            float size = 30;
            float fragmentSpeedBase = 0.8f;
            int   lifeTime          = (int)(30 * (float)(random.NextDouble()));
            int   nbrParticles      = 300;

            OverworldExplosion tempExplosion = new OverworldExplosion(game, spriteSheet);
            float fragmentSpeed = fragmentSpeedBase + (float)(random.NextDouble()) * fragmentSpeedBase;

            tempExplosion.GenerateAbsoluteExplosion(game, spriteSheet, source, nbrParticles, size,
                                                    randomDir: true, speed: fragmentSpeed, fragmentDur: lifeTime, fragmentSpeed: fragmentSpeed);

            game.soundEffectsManager.PlaySoundEffect(source.getDeathSoundID(), source.SoundPan);

            return(tempExplosion);
        }