Ejemplo n.º 1
0
 public virtual bool isColliding(AGameEntity ge)
 {
     if (hitBox.Intersects(ge.hitBox))
     {
         hasCollidedWith = ge.id;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        public void playerXprojectile(AGameEntity ge, AGameEntity ga)
        {
            Player player = (Player)ge;
            Orb    orb    = (Orb)ga;

            player.Hit(orb.Damage);
            removeFromWorld.Add(orb);
            if (player.Health < 0)
            {
                removeFromWorld.Add(player);
            }
        }
Ejemplo n.º 3
0
        public void enemyXenemyCollision(AGameEntity ge, AGameEntity ga)
        {
            if (ge.hasCollidedWith != EntityType.Neutral)
            {
                Enemy enemy = (Enemy)ge;

                switch (ge.id)
                {
                case EntityType.Blue:
                    if (ge.hasCollidedWith == EntityType.Red)
                    {
                        enemy.Shoot(EntityType.Purple, orbs);
                        ge.hasCollidedWith = EntityType.Neutral;
                        ga.hasCollidedWith = EntityType.Neutral;
                        break;
                    }
                    else if (ge.hasCollidedWith == EntityType.Green)
                    {
                        enemy.Shoot(EntityType.Cyan, orbs);
                        ge.hasCollidedWith = EntityType.Neutral;
                        ga.hasCollidedWith = EntityType.Neutral;
                        break;
                    }
                    break;

                case EntityType.Green:
                    if (ge.hasCollidedWith == EntityType.Red)
                    {
                        enemy.Shoot(EntityType.Yellow, orbs);
                        ge.hasCollidedWith = EntityType.Neutral;
                        ga.hasCollidedWith = EntityType.Neutral;
                        break;
                    }
                    else if (ge.hasCollidedWith == EntityType.Blue)
                    {
                        enemy.Shoot(EntityType.Cyan, orbs);
                        ge.hasCollidedWith = EntityType.Neutral;
                        ga.hasCollidedWith = EntityType.Neutral;
                        break;
                    }
                    break;

                case EntityType.Red:
                    if (ge.hasCollidedWith == EntityType.Blue)
                    {
                        enemy.Shoot(EntityType.Purple, orbs);
                        ge.hasCollidedWith = EntityType.Neutral;
                        ga.hasCollidedWith = EntityType.Neutral;
                        break;
                    }
                    else if (ge.hasCollidedWith == EntityType.Green)
                    {
                        enemy.Shoot(EntityType.Yellow, orbs);
                        ge.hasCollidedWith = EntityType.Neutral;
                        ga.hasCollidedWith = EntityType.Neutral;
                        break;
                    }
                    break;

                default:
                    return;
                }
            }
        }