public void LoadContent() // Loads the level { // Recreates the Entity lists Creatures = new List <Creature>(); DroppedItems = new List <DroppedItem>(); Projectiles = new List <Projectile>(); Game1.TextureManager.Reload(TexturesToLoad); // Plays the song of the level Game1.SongManager.Play(LevelMusic); // Loads the background and its content Background.LoadContent(); // Sets up the boss Boss = (Boss)Activator.CreateInstance(null, BossClassName).Unwrap(); Creatures.Add(Boss.Creature); // Loads the trading system for the level TradingManager.LoadTrading(); // Sets the player's position to the level's starting position Game1.WindowManager.GetGameplayWindow().Player.Creature.ChangePosition(PlayerStartingPosition); }
public void Draw(ref SpriteBatch spriteBatch) // Draws background then creatures { // Draws everything in this order: Background, Creatures, Items, Projectiles, Boss, Text Background.Draw(spriteBatch); foreach (Creature creature in Creatures) { creature.Draw(ref spriteBatch); } foreach (DroppedItem droppedItem in DroppedItems) { droppedItem.Draw(ref spriteBatch); } foreach (Projectile projectile in Projectiles) { projectile.Draw(ref spriteBatch); } if (Boss.IsAlive) { Boss.Draw(spriteBatch); Game1.FontManager.WriteText(spriteBatch, Boss.Name, new Vector2(640, 60)); } else { TradingManager.Draw(spriteBatch); Game1.FontManager.WriteText(spriteBatch, "Press N to Continue!", new Vector2(640, 480)); } }
public TradingBotClient(IRestClient restClient, IModelConverter modelConverter) { this.Health = HealthManager.Create(restClient, modelConverter); this.Instance = InstanceManager.Create(restClient, modelConverter); this.Trading = TradingManager.Create(restClient, modelConverter); this.Markets = MarketsManager.Create(restClient, modelConverter); this.Account = AccountManager.Create(restClient, modelConverter); this.Orders = OrdersManager.Create(restClient, modelConverter); }
public void Update(ref GameTime gameTime) { // Updates all creatures, if health is less than 0, they die. Removed from the creature less for (int i = Creatures.Count - 1; i >= 0; --i) { Creatures[i].Update(ref gameTime); if (Creatures[i].CurrentHealth <= 0) { Creatures[i] = null; Creatures.RemoveAt(i); } } // Updates all the items dropped on the ground for (int i = DroppedItems.Count - 1; i >= 0; --i) { DroppedItems[i].Update(ref gameTime); if (DroppedItems[i].LifeTime >= 300) // Removed after 5 mins { DroppedItems[i] = null; DroppedItems.RemoveAt(i); } } // Updates all the projectiles, if lifetime is less than or equal to 0, they are removed. for (int i = Projectiles.Count - 1; i >= 0; --i) { Projectiles[i].Update(ref gameTime); if (Projectiles[i].LifeTime <= 0) { Projectiles[i] = null; Projectiles.RemoveAt(i); } } // If the boss of the level is up then they are updates, when dead a text appears to press N to continue. Background.Update(gameTime); if (Boss.IsAlive) { Boss.Update(gameTime); } else { TradingManager.Update(gameTime); if (Game1.InputManager.KeyClicked(Microsoft.Xna.Framework.Input.Keys.N)) { Game1.WindowManager.GetGameplayWindow().NewLevel(NextLevel); } } }
} // This list is sent to the TextureManager during level loading to preload the textures of the levels to improve performance public Level() { TradingManager = new TradingManager(); }