//Draw method is called each time the map is updated //renders all of the symbols/colors for each cell to the map subconsole public void Draw(RLConsole mapConsole, RLConsole statConsole) { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } foreach (Door door in Doors) { door.Draw(mapConsole, this); } StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); //Index for the monster stat position int i = 0; //Iterate through each monster on the map and draw it after drawing the cells foreach (Monster monster in _monsters) { //When the monster is in the FOV draw the monster's stats if (IsInFov(monster.X, monster.Y)) { monster.Draw(mapConsole, this); //Pass in the index to DrawStats and increment it afterwards monster.DrawStats(statConsole, i); i++; } } }
void IPlaceableGenContext <StairsUp> .PlaceItem(Loc loc, StairsUp item) { var stairs = (StairsUp)item.Copy(); stairs.Loc = loc; this.GenEntrances.Add(stairs); }
// The Draw method will be called each time the map is updated // It will render all of the symbols/colors for each cell to the map sub console public virtual void Draw(RLConsole mapConsole, RLConsole statConsole, bool NextAnimation) { // Sets the right symbol for every cell of the map foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } // Draws the 2 stairs in the map StairsUp.Draw(mapConsole, this, false); StairsDown.Draw(mapConsole, this, false); DrawPuzzlePieces(mapConsole); foreach (Item item in Items) { item.Draw(mapConsole, this, false); } // Places the monsters after the doors,stairs and items so they appear above them int i = 0; foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this, NextAnimation); if (IsInFov(monster.X, monster.Y)) { monster.DrawStats(statConsole, i); i++; } } }
//Draws the map to the screen public void Draw(RLConsole mapConsole, RLConsole statsConsole) { //For each cell that exists, set the symbol based on // logic provided in SetSymbolForCell foreach (Cell cell in GetAllCells()) { SetSymbolForCell(mapConsole, cell); } //Draws the stairs up StairsUp.Draw(mapConsole, this); //Draws the stairs down and instantiates the interactive // object StairsDown.Draw(mapConsole, this); //Draws the open chest ChestOpen.Draw(mapConsole, this); //Draws the closed chest and instantiates the interactive // object ChestClosed.Draw(mapConsole, this); int i = 0; foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); if (IsInFov(monster.X, monster.Y)) { monster.DrawStats(statsConsole, i); i++; } } }
// The Draw method will be called each time the map is updated // It will render all of the symbols/colors for each cell to the map sub console public void Draw(RLConsole mapConsole, RLConsole statConsole) { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); // Keep an index so we know which position to draw monster stats at int i = 0; // Iterate through each monster on the map and draw it after drawing the Cells foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); // When the monster is in the field-of-view also draw their stats if (IsInFov(monster.X, monster.Y)) { // Pass in the index to DrawStats and increment it afterwards monster.DrawStats(statConsole, i); i++; } } }
//----------------------------- // Métodos //----------------------------- public void Draw(RLConsole mazmorraConsole, RLConsole statConsole) { foreach (Cell cell in GetAllCells( )) { SetConsoleSymbolForCell(mazmorraConsole, cell); } // Recordamos el índice para saber en cual posición dibujar la estadísticas del enemigo. int indice = 0; // Iteramos a través de cada enemigo en el mapa y lo dibujamos depués de haber dibujado las Celdas. foreach (Monster monster in _monsters) { // Cuando el enemigo se encuentre en el FOV (Campo de Visión) del jugador // dibujamos sus estadisticas. if (IsInFov(monster.X, monster.Y)) { monster.Draw(mazmorraConsole, this); // Pasamos el índice a DrawStats y luego lo incrementamos. monster.DrawStats(statConsole, indice); indice += 1; } } foreach (Door door in Doors) { door.Draw(mazmorraConsole, this); } StairsUp.Draw(mazmorraConsole, this); StairsDown.Draw(mazmorraConsole, this); }
/// <summary> /// The Draw method will be called each time the map is updated. /// It will send all of the symbols/colors for each cell to the graphics view /// </summary> public void Draw() { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(cell); } foreach (Door door in Doors) { door.Draw(this); } StairsUp.Draw(this); StairsDown.Draw(this); int i = -1; // Keep an index so we know which position to draw monster stats at // Start at -1 in case no monsters in view, then can clear the stat bars foreach (Monster monster in monsters) // Iterate through each monster on the map and draw it after drawing the Cells { monster.Draw(this); if (IsInFov(monster.X, monster.Y)) // When the monster is in the field-of-view also draw their stats { i++; monster.DrawStats(i); // Pass in the index to DrawStats and increment it afterwards } } if (i == -1) { game.ClearMonsterStats(); } }
public void Draw(RLConsole mapConsole, RLConsole statConsole) { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } //draw doors foreach (Door door in Doors) { door.Draw(mapConsole, this); } StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); //has to happen second to draw over existing cells //track index to move stats down each time int i = 0; foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); // When the monster is in the field-of-view also draw their stats if (IsInFov(monster.X, monster.Y)) { // Pass in the index to DrawStats and increment it afterwards monster.DrawStats(statConsole, i); i++; } } }
public void Draw(RLConsole mapConsole, RLConsole statConsole) { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } int i = 0; foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); if (IsInFov(monster.X, monster.Y)) { monster.DrawStats(statConsole, i); i++; } } foreach (Door door in Doors) { door.Draw(mapConsole, this); } StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); }
public void Draw(RLConsole mapConsole, RLConsole statConsole) { mapConsole.Clear(); foreach (ICell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } int i = 0; foreach (Monster monster in Monsters) { if (monster.Size == 1) { if (IsInFov(monster.X, monster.Y)) { monster.Draw(mapConsole, this); monster.DrawStats(statConsole, i); i++; } else { if (GetCell(monster.X, monster.Y).IsExplored) { mapConsole.Set(monster.X, monster.Y, Colors.Floor, Colors.FloorBackground, '.'); } } } else { // If player can see at least one part of the big monster, draw it fully if (monster.AreaControlled.Any(cell => IsInFov(cell.X, cell.Y))) { monster.Draw(mapConsole, this); monster.DrawStats(statConsole, i); i++; } // If big monster is fully out from FoV, draw dots on its place else if (monster.AreaControlled.All(cell => !IsInFov(cell.X, cell.Y) && IsExplored(cell.X, cell.Y))) { foreach (ICell cell in monster.AreaControlled) { mapConsole.Set(cell.X, cell.Y, Colors.Floor, Colors.FloorBackground, '.'); } } } } foreach (IItem item in Items) { item.Draw(mapConsole, this); } foreach (Door door in Doors) { door.Draw(mapConsole, this); } StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); }
// The Draw method will be called each time the map is updated // It will render all of the symbols/colors for each cell to the map sub console public void Draw(RLConsole mapConsole, RLConsole statConsole, RLConsole inventoryConsole) { //clear the map mapConsole.Clear(); // Drawing the cells. foreach (DungeonCell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } // Drawing the doors. foreach (Door door in Doors) { door.Draw(mapConsole, this); } // Drawing Stairs. StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); // Drawing treasure foreach (TreasurePile treasurePile in _treasurePiles) { IDrawable drawableTreasure = treasurePile.Treasure as IDrawable; drawableTreasure?.Draw(mapConsole, this); } // clear the stats statConsole.Clear(); // Keep an index so we know which position to draw monster stats at int i = 0; // Iterate through each monster on the map and draw it after drawing the Cells foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); // When the monster is in the field-of-view also draw their stats if (IsInFov(monster.X, monster.Y)) { // Pass in the index to DrawStats and increment it afterwards monster.DrawStats(statConsole, i); i++; } } Player player = Game.Player; //update the player and player info. player.Draw(mapConsole, this); player.DrawStats(statConsole); player.DrawInventory(inventoryConsole); }
/// <summary> /// This method will be called each time the map is updated. /// It will render all of the symbols/colors for each cell to the map subconsole, /// as well as draw all the monsters and doors. /// </summary> /// <param name="mapConsole"></param> /// <param name="statConsole"></param> public void Draw(RLConsole mapConsole, RLConsole statConsole) { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } foreach (Door door in Doors) { door.Draw(mapConsole, this); } foreach (Plant plant in Plants) { plant.Draw(mapConsole, this); } // Add one stairs up and one stairs down per level. if (StairsUp != null) // we don't have stairs in the overworld { StairsUp.Draw(mapConsole, this); } StairsDown.Draw(mapConsole, this); // Draw our treasure piles foreach (ITreasurePile treasurePile in treasurePiles) { IDrawable drawableTreasure = treasurePile.Treasure as IDrawable; drawableTreasure?.Draw(mapConsole, this); } // Keep an index so we know which position to draw monster stats at int i = 0; // Iterate through each monster on the map and draw it after drawing the Cells foreach (Monster monster in monsters) { // When the monster is in the field-of-view also draw their stats if (IsInFov(monster.X, monster.Y)) { monster.Draw(mapConsole, this); // Pass in the index to DrawStats and increment it afterwards monster.DrawStats(statConsole, i); i++; } } }
// The draw method is called every time the map is updated // it will render all of the symbols/colors for each cell to the map console public void Draw(RLConsole mapConsole, RLConsole statConsole) { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } foreach (Door door in Doors) { door.Draw(mapConsole, this); } foreach (Column column in Columns) { column.Draw(mapConsole, this); } StairsDown.Draw(mapConsole, this); StairsUp.Draw(mapConsole, this); int i = 0; // Index to know which postion to draw monster stats at foreach (Monster monster in Monsters) { monster.Draw(mapConsole, this); // Only draw stats for the monsters that are in FOV if (IsInFov(monster.X, monster.Y)) { monster.DrawStats(statConsole, i); i++; } } foreach (GoldPile gold in GoldPiles) { gold.Draw(mapConsole, this); } foreach (Item item in Items) { item.Draw(mapConsole, this); } }
//The Draw method will be called each time the map is updated //It will render all of the symbols or colors for each cell to the map sub console we created earlier public void Draw(RLConsole mapConsole, RLConsole statConsole) { //ineffecient too redraw code everytime //clear what was previously on the map console //mapConsole.Clear(); //foreach of the cells in the foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } foreach (Door door in Doors) { door.Draw(mapConsole, this); } StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); //keep an index so we know which position to draw monster stats at int i = 0; foreach (TreasurePile treasurePile in _treasurePiles) { IDrawable drawableTreasure = treasurePile.Treasure as IDrawable; drawableTreasure?.Draw(mapConsole, this); } foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); //if a monster is in field of view draw there stats too the stat console if (IsInFov(monster.X, monster.Y)) { monster.DrawStats(statConsole, i); i++; } } }
private void GeneratePathes(int stairsX, int stairsY) { BreakTheWall((Wall)LabLevel[stairsX, stairsY]); while (WallsToDemolish.Any()) { RedrawLevel(); var wall = GetRandom(WallsToDemolish); if (CanBreakTheWall(wall)) { BreakTheWall(wall); } else { WallsToDemolish.Remove(wall); } } LabLevel[stairsX, stairsY] = new StairsUp(stairsX, stairsY); }
public void Draw(RLConsole mapConsole, RLConsole statConsole, RLConsole timeLineConsole) { //Draw base cells foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } //Draw stairs StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); //Draw items foreach (Item item in Items) { item.Draw(mapConsole, this); } //Draw monsters foreach (Monster monster in Monsters) { monster.Draw(mapConsole, this); monster.UpdateTimeline(GameController.Timeline, this); } int i = 0; foreach (Monster monster in Monsters) { // When the monster is in the field-of-view also draw their stats if (IsInFov(monster.X, monster.Y)) { monster.Draw(mapConsole, this); // Pass in the index to DrawStats and increment it afterwards monster.DrawStats(statConsole, i); i++; } } }
// The Draw method will be called each time the map is updated // It will render all of the symbols/colors for each cell to the map sub console public void Draw(RLConsole mapConsole, RLConsole statConsole, RLConsole inventoryConsole) { foreach (Cell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } foreach (Door door in Doors) { door.Draw(mapConsole, this); } StairsUp.Draw(mapConsole, this); StairsDown.Draw(mapConsole, this); //Keep an index so we know which position to draw monster stats at int i = 0; //Iterate through each monster on the map and draw it after drawing the cells foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); //When the monster is in the FOV, also draw their stats if (IsInFov(monster.X, monster.Y)) { //pass in the index to DrawStats and increment it afterwards monster.DrawStats(statConsole, i); i++; } } foreach (Treasure gold in _treasurePiles) { gold.Draw(mapConsole, this); } Game.Player.DrawInventory(inventoryConsole); }
public void Draw(RLConsole mapConsole, RLConsole statConsole) { mapConsole.Clear(); foreach (ICell cell in GetAllCells()) { SetConsoleSymbolForCell(mapConsole, cell); } foreach (Door door in Doors) { door.Draw(mapConsole, this); } foreach (Plant plant in Plants) { plant.Draw(mapConsole, this); } if (StairsUp != null) { StairsUp.Draw(mapConsole, this); } if (StairsDown != null) { StairsDown.Draw(mapConsole, this); } foreach (TreasurePile treasurePile in _treasurePiles) { IDrawable drawableTreasure = treasurePile.Treasure as IDrawable; drawableTreasure?.Draw(mapConsole, this); } foreach (Item item in _items) { IDrawable drawableItem = item as IDrawable; drawableItem?.Draw(mapConsole, this); } foreach (Trap trap in _traps) { IDrawable drawableTrap = trap as IDrawable; drawableTrap?.Draw(mapConsole, this); } foreach (Actor shopkeeper in _shopkeepers) { shopkeeper.Draw(mapConsole, this); } foreach (Actor explorer in _explorers) { explorer.Draw(mapConsole, this); } statConsole.Clear(); int i = 0; foreach (Monster monster in _monsters) { monster.Draw(mapConsole, this); if (IsInFov(monster.X, monster.Y) && monster.IsMimicInHiding == false) { monster.DrawStats(statConsole, i); i++; } } }
protected StairsUp(StairsUp other) : base(other) { }