Example #1
0
        public override void Update(SadConsole.Console console, TimeSpan delta)
        {
            var m = ctx.CurMap;

            foreach (var nPos in m.FOV.NewlyUnseen)
            {
                foreach (var vChild in m.GetEntities <DrawableObject>(nPos))
                {
                    vChild.DrawEntity.IsVisible = false;
                }
                if (m.Explored[nPos])
                {
                    var eBG = (m.Terrain[nPos] as Terrain).Name == "Wall" ? Swatch.ExploredWall : Swatch.ExploredFloor;
                    console.SetCellAppearance(nPos.X, nPos.Y, new Cell(Color.Transparent, eBG));
                }
                else
                {
                    console[nPos.X, nPos.Y].IsVisible = false;
                }
            }
            foreach (var sPos in m.FOV.NewlySeen)
            {
                console[sPos.X, sPos.Y].IsVisible = true;
                console.SetCellAppearance(sPos.X, sPos.Y, (m.Terrain[sPos] as Terrain).DrawCell);
                foreach (var obj in m.GetEntities <DrawableObject>(sPos))
                {
                    obj.DrawEntity.IsVisible = true;
                }
            }

            //console.Update(delta);
        }
Example #2
0
 public static void PlaceTree(this Console map, Point position)
 {
     // Place trunk
     map.SetCellAppearance(position.X, position.Y, Trunk);
     // Add Shadows
     // TODO: Check if height differs etc...
     for (int i = 0; i < TreeShadowShape.Length; i++)
     {
         int  x   = position.X + TreeShadowShape[i].X;
         int  y   = position.Y + TreeShadowShape[i].Y;
         Cell old = map.GetCellAppearance(x, y);
         map.SetCellAppearance(x, y, new Cell((old.Foreground).FillAlpha(), (old.Background * .8f).FillAlpha(), old.Glyph));
     }
 }