Beispiel #1
0
        public void UpdateViewOfCoords(ScrollingConsole console, IEnumerable <Coord> coords)
        {
            //  Show the BG color of the terrain, then whatever comes first:
            //  The FG of any visible being at the location, or
            //  the FG of the topmost item at the loc'n, or
            //  the FG of the terrain type.
            //  Then (later, 0.5?) modified by lighting, et c.
            foreach (var position in coords.Where(c => console.ViewPort.Contains(c)))
            {
                var targetCell = new Cell();
                var rawCell    = SpaceMap.GetItem(position).Terrain.Cell;
                targetCell.Background = rawCell.Background;

                var beings = BeingMap.GetItems(position).ToList();
                var items  = ItemMap.GetItems(position).ToList();
                if (beings.Any())
                {
                    var being = beings.Last();
                    targetCell.Foreground = being.Foreground;
                    targetCell.Glyph      = being.Glyph;
                }
                else if (items.Any())
                {
                    var item = items.Last();
                    targetCell.Foreground = item.Foreground;
                    targetCell.Glyph      = item.Glyph;
                }
                else
                {
                    targetCell.Foreground = rawCell.Foreground;
                    targetCell.Glyph      = rawCell.Glyph;
                }

                console.SetCellAppearance(position.X, position.Y, targetCell);

                var  rot  = RotMap.GetItem(position);
                Fade fade = null;
                if (rot?.Health > 0)
                {
                    fade = GetFadeForRotExtent(rot.Health, rawCell.Background);
                }
                EffectsManager.SetEffect(console.Cells[position.Y * Width + position.X], fade);
            }
        }
Beispiel #2
0
        public void UpdateFOV(ScrollingConsole console, Coord position)
        {
            FOV.Calculate(position);

            SpaceMap.SeeCoords(FOV.NewlySeen);

            //  Cells outside of FOV are gray on black,
            // with only the glyph of the terrain showing.
            var unseenCell = new Cell(Color.DarkGray, Color.Black, ' ');

            foreach (var location in FOV.NewlyUnseen.Where(c => console.ViewPort.Contains(c)))
            {
                //  Wiping the effect restores the original cell colors,
                // so it must happen before setting OOV appearance
                EffectsManager.SetEffect(console.Cells[location.Y * Width + location.X], null);
                unseenCell.Glyph = SpaceMap.GetItem(location).Terrain.Cell.Glyph;
                console.SetCellAppearance(location.X, location.Y, unseenCell);
            }

            UpdateViewOfCoords(console, FOV.NewlySeen);
        }
Beispiel #3
0
 public bool CanPlant(Coord location) => SpaceMap.CanPlant(location);
Beispiel #4
0
 public bool CanWalkThrough(Coord location) => SpaceMap.CanWalkThrough(location);