/// <summary> /// Update Function /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { meteorManager = Game.Services.GetService <MeteorSpawnManager>(); //Updates bullet speed bulletPosition.Y -= SPEED; //Sets hitbox of bullet boundingBox = bulletTexture.Bounds; boundingBox.Location = bulletPosition.ToPoint(); //Checks if bullet is offscreen and removes it if it is, otherwise calls the check for collision methond if (bulletPosition.Y <= -bulletTexture.Height) { Game.Components.Remove(this); } else { if (meteorManager.IsThereCollision(this)) { Game.Components.Remove(this); } } base.Update(gameTime); }
/// <summary> /// Default Constructor /// </summary> /// <param name="game"></param> public MeteorSpawnManager(Game game, GameScene parent) : base(game) { Game.Services.AddService <MeteorSpawnManager>(this); player = Game.Services.GetService <Player>(); meteorManager = Game.Services.GetService <MeteorSpawnManager>(); this.parent = parent; random = new Random(); }