Esempio n. 1
0
        public ProjectileMarioCollisionResponse(IMario m, IProjectile p, CollisionSide type)
        {
            Rectangle intersection = Rectangle.Intersect(m.Position, p.Position);

            Console.WriteLine("In the response");
            if (p is ShellProjectile)
            {
                if (p.ShellCount < 1)
                {
                    if (type == CollisionSide.Left || type == CollisionSide.Top)
                    {
                        m.BounceX(-intersection.Width);
                        m.BounceY(-intersection.Height);
                        p.Move();
                        p.ShellCount++;
                        Console.WriteLine("In the response block");
                    }
                    else if (type == CollisionSide.Right)
                    {
                        m.BounceX(intersection.Width);
                        p.MoveLeft();
                        p.ShellCount++;
                    }
                }
                else
                {
                    m.Die();
                }
            }
        }
Esempio 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();
            }
        }
Esempio n. 3
0
 public MarioDeadState(IMario mario) : base(mario)
 {
     this.mario = mario;
     mario.UpdateArt();
     MarioGame.Instance.SwitchMapping("dead");
     mario.Die();
 }
Esempio n. 4
0
 public MarioNightmareEnemyCollisionResponse(IMario m, FlyingEnemy n, CollisionSide c, Game1 g)
 {
     if (c == CollisionSide.None)
     {
         //Do nothing.
     }
     else
     {
         m.Die();
     }
 }
Esempio n. 5
0
 public void Die()
 {
     decoratedMario.Die();
 }