private void CleanPlatforms() { Platforms.RemoveAll(p => { if (p.HasGuy && p.GuyOnStairs.HasBeenDestroyed) { return(p.GuyOnStairs.HasFallen && p.Position.X + p.Width < 0); } return(p.Position.X + p.Width < 0); }); }
public override void GameRestart() { Platforms.RemoveAll(); DisposedManager.RemoveAll(); Generator.Reset(); }
// Update // // functions // - Get and send input states to the InputHandler // - Check collisions for all my MY projectiles and enemies // - Log any collisions for my projectiles and ME // - Check collisions for all enemies/projectiles and ME // - Log my HP if hit // - Check if I die and do anything I gotta // - Update my position if I'm moving // - collide with platforms below me // - Log my position is I'm moving // // returns // protected override void Update(GameTime gameTime) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } Cursor.Pos = new Vector2(Mouse.GetState().Position.X, Mouse.GetState().Position.Y); ReadInput(Mouse.GetState(), Keyboard.GetState()); HandleInput(); if (gameStarted) { CheckEvents(); foreach (Skeleton s in Enemies) { s.Update(Stage, KillZones); } foreach (Doot p in Projectiles) { p.Update(KillZones); } Projectiles.RemoveAll(p => p.Marked); foreach (PickUp p in PickUps) { p.Update(); } PickUps.RemoveAll(p => p.Marked); foreach (Tracer t in Tracers) { t.Update(); } Tracers.RemoveAll(p => p.Opacity <= 0); foreach (Platform p in Platforms) { p.Update(); } Platforms.RemoveAll(p => p.Opacity <= 0); if (boss != null && boss.Active) { boss.Update(); } player.Update(Platforms, KillZones, PickUps); boss.UpdateHPBar(); } foreach (SpriteText s in Text) { s.Move(gameTime); } Text.RemoveAll(s => s.Opacity <= 0); Cursor.Animate(); base.Update(gameTime); }