public void Render(MapObject mapObject)
        {
            MapPoint cellPoint = new MapPoint(0, 0, 0);
            Map      map       = new Map(1, MapSize.One);

            map[cellPoint] = new MapCell(new MapPlace(), null);
            if (mapObject is MapPlace)
            {
                map[cellPoint].Place = mapObject as MapPlace;
            }
            if (mapObject is MapWall)
            {
                map[cellPoint].SetWall(MapDirection.North, mapObject as MapWall);
                map[cellPoint].SetWall(MapDirection.East, mapObject as MapWall);
                map[cellPoint].SetWall(MapDirection.West, mapObject as MapWall);
                map[cellPoint].SetWall(MapDirection.South, mapObject as MapWall);
            }
            MapState mapState = new MapState(map);

            if (mapObject is MapActiveObject)
            {
                mapState.AddActiveObject(mapObject as MapActiveObject, cellPoint);
            }
            GameMap gameMap = new GameMap(mapState);

            Renderer.SetMap(gameMap, new MapCellRange(cellPoint, cellPoint));
            Renderer.Render();
        }
Exemple #2
0
        public void OnTargetMapChanged(MapViewModel newValue)
        {
            if (newValue == null)
            {
                return;
            }

            GameMap map = newValue.Source;

            newValue.PropertyChanged   += new System.ComponentModel.PropertyChangedEventHandler(map_PropertyChanged);
            Renderer.IsGridLinesVisible = newValue.IsGridLinesVisible;
            Renderer.SetMap(map, map.Map.Range);
            Render();
        }