Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
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);
        }