Ejemplo n.º 1
0
        protected override void Die(Warhead warhead)
        {
            InfantryDeathType infantryDeathType = warhead.GetInfantryDeathType();
            Explosion         explosion         = new InfantryDeath(World, Position, Sprites.RocketInfantry, infantryDeathType.GetSpriteName());

            World.AddExplosion(explosion);

            infantryDeathType.GetSoundEffect().Play();
        }
Ejemplo n.º 2
0
        public static string GetSpriteName(this InfantryDeathType self)
        {
            List <string> explosiveDeaths = new List <string>()
            {
                "die2", "die3", "die4"
            };

            switch (self)
            {
            case InfantryDeathType.Bullet:
                return("die1");

            case InfantryDeathType.Explosive:
                return(explosiveDeaths[new Random().Next(explosiveDeaths.Count)]);

            case InfantryDeathType.Fire:
                return("die5");

            default:
                throw new Exception("unhandled death type: " + self.ToString());
            }
        }
Ejemplo n.º 3
0
        public static SoundEffect GetSoundEffect(this InfantryDeathType self)
        {
            List <SoundEffect> deathSounds = new List <SoundEffect>()
            {
                Sounds.InfantryDeath1, Sounds.InfantryDeath2, Sounds.InfantryDeath3, Sounds.InfantryDeath4
            };

            switch (self)
            {
            case InfantryDeathType.Bullet:
                return(Sounds.InfantryDeath4);

            case InfantryDeathType.Explosive:
                return(deathSounds[new Random().Next(deathSounds.Count)]);

            case InfantryDeathType.Fire:
                return(Sounds.InfantryDeath1);

            default:
                throw new Exception("unhandled death type: " + self.ToString());
            }
        }