Ejemplo n.º 1
0
 public MarioEnemyCollisionResponse(IMario m, IEnemy e, CollisionSide c, List <IEnemy> enemies, List <IProjectile> projectiles, Game1 g)
 {
     if (c == CollisionSide.Top)
     {
         if (e is TurtleEnemy)
         {
             m.Bounce();
             Console.WriteLine("Adding Shell");
             projectiles.Add(ProjectileFactory.Instance.CreateShell(new Microsoft.Xna.Framework.Vector2(e.Location.X, e.Location.Y + 49)));
         }
         else
         {
             e.Stomped();
             m.Bounce();
         }
         SoundEffectFactory.Instance.CreateEnemyStompSound().PlaySound();
         m.consecutiveCrash = true;
         m.SmashEnemy();
         enemies.Remove(e);
         //m.Bounce();
     }
     else
     {
         if (!m.Invincible)
         {
             g.Character.Die();
         }
         else if (m.Invincible)
         {
             SoundEffectFactory.Instance.CreateProjectileHitSound().PlaySound();
             enemies.Remove(e);
         }
     }
 }
Ejemplo n.º 2
0
        public MarioNightmareEnemyCollisionResponse(IMario m, INightmareEnemy n, List <IZombie> zombies, CollisionSide c, Game1 g)
        {
            timer--;  // = g.TargetElapsedTime.TotalSeconds;
            delayTimer = timer + 2;

            if (c == CollisionSide.Top)
            {
                if (!g.nightmareThemeIsStarted)
                {
                    MediaPlayer.Play(g.nightmareTheme);
                    g.nightmareThemeIsStarted = true;
                }
                m.Bounce();
                n.Die();
                if (timer == 0)
                {
                    locale.X = n.Location.X;
                    locale.Y = n.Location.Y + n.Texture.Height;
                    SoundEffectFactory.Instance.CreateNightmareZombieSpawnSound().PlaySound();
                    zombies.Add(ZombieFactory.Instance.CreateZombie(locale));
                    timer = 1;
                    n.Die();
                }
            }
            else
            {
                m.Die();
            }
        }
Ejemplo n.º 3
0
 public void Execute()
 {
     mario.Bounce();
 }