CNCMaps.Engine.Game.Theater.Draw C# (CSharp) Метод

Draw() приватный Метод

private Draw ( GameObject obj, CNCMaps.Engine.Rendering.DrawingSurface ds ) : void
obj CNCMaps.Engine.Map.GameObject
ds CNCMaps.Engine.Rendering.DrawingSurface
Результат void
        internal void Draw(GameObject obj, DrawingSurface ds)
        {
            Logger.Trace("Drawing object {0} @ {1}", obj, obj.Tile);
            obj.Drawable?.Draw(obj, ds);
        }

Usage Example

Пример #1
0
        public void UndrawTiledStartPositions()
        {
            Palette red = Palette.MakePalette(Color.Red);

            foreach (var w in _wayPoints)
            {
                // Redraw the 4x4 cell around start pos with original palette;
                // first the tiles, then the objects
                for (int x = w.Tile.Rx - 2; x < w.Tile.Rx + 2; x++)
                {
                    for (int y = w.Tile.Ry - 2; y < w.Tile.Ry + 2; y++)
                    {
                        MapTile t = _tiles.GetTileR(x, y);
                        if (t == null)
                        {
                            continue;
                        }
                        t.Palette = _palettePerLevel[t.Z];
                        // redraw tile
                        _theater.Draw(t, _drawingSurface);
                    }
                }
                for (int x = w.Tile.Rx - 5; x < w.Tile.Rx + 5; x++)
                {
                    for (int y = w.Tile.Ry - 5; y < w.Tile.Ry + 5; y++)
                    {
                        MapTile t = _tiles.GetTileR(x, y);
                        if (t == null)
                        {
                            continue;
                        }
                        // redraw objects on here
                        List <GameObject> objs = GetObjectsAt(t.Dx, t.Dy / 2);
                        foreach (GameObject o in objs)
                        {
                            _theater.Draw(o, _drawingSurface);
                        }
                    }
                }
            }
        }