Ejemplo n.º 1
0
 public void SetUp()
 {
     Dungeon1 = new AtlasWarriorsGame.Dungeon(10, 10);
     Dungeon2 = new AtlasWarriorsGame.Dungeon(20, 10);
     Dungeon3 = new AtlasWarriorsGame.Dungeon(10, 20);
     Dungeon4 = new AtlasWarriorsGame.Dungeon(10, 10);
     Dungeon4.SetCell(new XY(2, 1), DungeonCell.Empty);
     Dungeon4.SetCell(new XY(2, 2), DungeonCell.Wall);
     Dungeon4.SetCell(new XY(2, 3), DungeonCell.Door);
     Dungeon4.SetCell(new XY(2, 4), DungeonCell.Door);
     Dungeon4.SetCell(new XY(2, 5), DungeonCell.Floor);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Draw the map to the console
        /// </summary>
        /// <param name="Dungeon">Dungeon to draw</param>
        /// <param name="ForceDrawAll">Whether to force drawing whole map</param>
        static void DrawMap(AtlasWarriorsGame.Dungeon Dungeon, bool ForceDrawAll = false)
        {
            // Get the furthest on each edge that's visible
            // Initialising with max/min possible for min/max respectively
            int leftToShow   = Dungeon.Width;
            int rightToShow  = 0;
            int topToShow    = Dungeon.Height;
            int bottomToShow = 0;

            for (int iy = 0; iy < Dungeon.Height; ++iy)
            {
                for (int ix = 0; ix < Dungeon.Width; ++ix)
                {
                    // If in room mode and visible, or if seen
                    if (ForceDrawAll ||
                        ((displayMode == DisplayMode.ROOM) &&
                         (Dungeon.GetVisibility(new XY(ix, iy)) == Dungeon.CellVisibility.VISIBLE)) ||
                        ((displayMode == DisplayMode.ALL) &&
                         (Dungeon.GetVisibility(new XY(ix, iy)) != Dungeon.CellVisibility.UNSEEN)))
                    {
                        leftToShow   = Math.Min(leftToShow, ix);
                        rightToShow  = Math.Max(rightToShow, ix);
                        topToShow    = Math.Min(topToShow, iy);
                        bottomToShow = Math.Max(bottomToShow, iy);
                    }
                }
            }

            for (int iy = topToShow; iy <= bottomToShow; ++iy)
            {
                Console.WriteLine();
                for (int ix = leftToShow; ix <= rightToShow; ++ix)
                {
                    // Get character, unless unseen in which get space
                    var tileChar = Dungeon.GetVisibility(new XY(ix, iy))
                                   != Dungeon.CellVisibility.UNSEEN ?
                                   CellToScreen.CellScreenChar(Dungeon.GetCell(new XY(ix, iy))) : ' ';
                    var tileActors = (Dungeon.Actors.Where(i => i.Location == (new XY(ix, iy))));
                    if (tileActors.Count() > 0)
                    {
                        tileChar = CellToScreen.ActorToChar(tileActors.First());
                        Tolk.Output(tileActors.First().SpriteId);
                    }
                    else
                    {
                        Tolk.Output(Dungeon.GetCell(new XY(ix, iy)).ToString());
                    }
                    Console.Write(tileChar);
                }
                Tolk.Output("Next Row");
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Create passage with given values, with a dungeon instead of ID
 /// </summary>
 /// <param name="passageType">Type of passage</param>
 /// <param name="destination">Dungeon passage goes to</param>
 /// <param name="location">Location on map of passage</param>
 public Passage(PassageTypeEnum passageType, Dungeon destination, XY location = null)
 {
     this.PassageType = passageType;
     this.Destination = destination;
     this.Location    = location;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create Actor on given level
 /// </summary>
 /// <param name="Dungeon">Dungeon where actor is</param>
 /// <param name="location">
 /// Location actor starts in dungeon. If null, Dungeon.StartLocation.
 /// </param>
 public Actor(Dungeon Dungeon, XY location = null)
 {
     this.Dungeon = Dungeon;
     Dungeon.Actors.Add(this);
     Location = location ?? Dungeon.StartLocation;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Send message to dungeon/game
 /// </summary>
 /// <param name="message">Message to send</param>
 virtual protected void SendMessage(Message.Message message)
 {
     Dungeon?.AddMessage(message);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Create monster in dungeon in location
 /// </summary>
 /// <param name="dungeon">Dungeon monster in</param>
 /// <param name="location">Location monster in</param>
 public Monster(Dungeon dungeon, XY location) : base(dungeon)
 {
     Location = location;
     Team     = 1;
 }