public void Handle_and_CheckWeaponCollisionLightUp(GameObject gameObject, GameTime gameTime) { if (gameObject.isAlive) { foreach (KeyValuePair <int, WeaponObject[]> entry in mainPlayer.weaponDict) { foreach (WeaponObject w in entry.Value) { if (w.isAlive && w.isSolid) { if (gameObject.CheckCollision(w.position, w.texture.Width, w.texture.Height)) { w.isAlive = false; gameObject.customRGBA += 3; gameObject.rotation -= 0.003f; totalAngularVelocity -= 0.003f; if (gameObject.customRGBA > 254) { PE1.AddExplosion(PE1.ParticleArray, PE1.MaxParticles, gameObject.position, PE1.ExplosionSize, gameTime, w.velocity); mainPlayer.activeTextureID = 11; gameObject.isAlive = false; gameObject.isKilled = true; Game.Components.Remove(gameObject); gameObject.Dispose(); } } } } } } }
public override void Update(GameTime gameTime) { feynmanLecture.position.Y += gravity; Handle_and_CheckWeaponCollisionFeynman(feynmanLecture); foreach (EnemyObject e in feynmanLecture.enemies1) { Handle_and_CheckWeaponCollision(e); } foreach (EnemyObject e in feynmanLecture.enemies2) { Handle_and_CheckWeaponCollision(e); } foreach (EnemyObject e in feynmanLecture.enemies3) { Handle_and_CheckWeaponCollision(e); } foreach (EnemyObject e in feynmanLecture.enemies4) { Handle_and_CheckWeaponCollision(e); } foreach (EnemyObject e in feynmanLecture.enemies5) { Handle_and_CheckWeaponCollision(e); } foreach (EnemyObject e in feynmanLecture.enemies6) { Handle_and_CheckWeaponCollision(e); } if (feynmanLecture.position.Y > Game1.screenHeight) { PE1.AddExplosion(PE1.ParticleArray, PE1.MaxParticles, mainPlayer.position, PE1.ExplosionSize, gameTime, mainPlayer.velocity); } if (mainPlayer.IsInsideScreen(mainPlayer.textureList[mainPlayer.activeTextureID]) == false) { mainPlayer.position = new Vector2(Game1.screenWidth / 2, Game1.screenHeight - 100); } base.Update(gameTime); }