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; }
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; }
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); }