示例#1
0
 public MarioNightmareEnemyCollisionResponse(IMario m, FlyingEnemy n, CollisionSide c, Game1 g)
 {
     if (c == CollisionSide.None)
     {
         //Do nothing.
     }
     else
     {
         m.Die();
     }
 }
示例#2
0
        public MarioNightmareEnemyCollisionDetector(Game1 g, FlyingEnemy n)
        {
            Rectangle mario = g.Character.Position;
            Rectangle nm    = new Rectangle((int)n.Position.X, (int)n.Position.Y, EnemyFactory.Instance.flyingEnemy.Height, EnemyFactory.Instance.flyingEnemy.Width / 2);

            CollisionSide type = CollisionDetector.Detect(mario, nm);


            if (type != CollisionSide.None)
            {
                new MarioNighmareEnemyCollisionResponsecs(g.Character, n, type, g);
            }
        }
示例#3
0
        private void MarioFlyingEnemyCollision()
        {
            for (int i = 0; i < flyingEnemy.Count; i++)
            {
                FlyingEnemy fe    = flyingEnemy[i];
                Rectangle   enemy = fe.Position;
                Rectangle   m     = g.Character.Position;

                CollisionSide cs = CollisionDetector.Detect(m, enemy);

                if (cs != CollisionSide.None)
                {
                    new MarioNightmareEnemyCollisionResponse(g.Character, fe, cs, g);
                }
            }
        }