Пример #1
0
 public bool collisionCheckLaserAsteroid(BoundingSphere sphere, Spawn spawn, HUD hud)
 {
     for (int i = 0; i < spawn.asteroid.Count(); i++)
         if (spawn.asteroid[i].getBoundingSphere().Intersects(sphere))
         {
             spawn.asteroid.RemoveAt(i);
             Boss1 bosslife;
         }
     return true;
 }
Пример #2
0
        public bool collisionCheckLaserEnemy(BoundingSphere sphere, Spawn spawn, HUD hud)
        {
            for (int i = 0; i < spawn.enemies.Count(); i++)
                if (spawn.enemies[i].getBoundingSphere().Intersects(sphere))
                {
                        spawn.enemies.RemoveAt(i);
                        killedEnemies++;

                }
            return true;
        }
Пример #3
0
 public bool collisionCheckEnemyLaserPlayer(BoundingSphere sphere, Spawn spawn, HUD hud,Player player)
 {
     for (int i = 0; i < spawn.enemies.Count(); i++)
         for (int j = 0; j < spawn.enemies[i].shoot1.enemyLaser.Count();j++ )
             if (spawn.enemies[i].shoot1.enemyLaser[j].getBoundingSphere().Intersects(sphere))
             {
                 player.playerHealth -= 5;
                 hud.rectangle.Width = (int)(300 * (player.playerHealth / 100));
                 spawn.enemies[i].shoot1.enemyLaser.RemoveAt(j);
             }
     return true;
 }
Пример #4
0
        public bool collisionCheckLaserBoss1(BoundingSphere sphere, Spawn spawn, HUD hud)
        {
            for (int i = 0; i < spawn.boss1.Count(); i++)
                if (spawn.boss1[i].getBoundingSphere().Intersects(sphere))
                {
                    if (boss1.getBossLife() <= 0f)
                    {
                        spawn.boss1.RemoveAt(i);
                    }
                    else
                    {
                        boss1.setBosslife(boss1.getBossLife() - 0.01f);
                        hud.rectangleBoss.Width = (int)(700*((boss1.getBossLife()/100)));
                    }

                }
            return true;
        }
Пример #5
0
 public bool collisionCheckPlayerAsteroid(BoundingSphere sphere, Spawn spawn, HUD hud,Player player)
 {
     for (int i = 0; i < spawn.asteroid.Count(); i++)
         if (spawn.asteroid[i].getBoundingSphere().Intersects(sphere))
         {
             player.playerHealth -= 20;
             hud.rectangle.Width = (int)(300*(player.playerHealth/100));
             spawn.asteroid.RemoveAt(i);
         }
     return true;
 }
Пример #6
0
        public void Update(GameTime gameTime, Player player, Spawn spawn, HUD hud, int killedEnemies)
        {
            this.killedEnemies = killedEnemies;

            collisionCheckPlayerAsteroid(player.getBoundingSphere(), spawn, hud,player);

            for (int j = 0; j < player.shoot.laser.Count(); j++)
            {
                collisionCheckLaserAsteroid(player.shoot.laser[j].getBoundingSphere(), spawn, hud);
            }

            for (int j = 0; j < player.shoot.laser.Count(); j++)
            {
                collisionCheckLaserEnemy(player.shoot.laser[j].getBoundingSphere(), spawn, hud);
            }

            for (int j = 0; j < player.shoot.laser.Count(); j++)
            {
                collisionCheckLaserBoss1(player.shoot.laser[j].getBoundingSphere(), spawn, hud);
            }
            collisionCheckBossLaserPlayer(player.getBoundingSphere(), spawn, hud, player);

            collisionCheckEnemyLaserPlayer(player.getBoundingSphere(), spawn, hud, player);

            collisionCheckPlayerEnemy(player.getBoundingSphere(), spawn, hud, player);
        }