예제 #1
0
        public void InitializeMap(MapParameters parameters)
        {
            MapBuilder builder   = new ProcedureMapBuilder();
            var        director  = new MapDirector(builder);
            var        mapParams = new MapParameters {
                MapObjectPrefabs = _mapObjectPrefabs,
                MainMapSprite    = _mainSprite,
                MapLength        = _mapLength,
                MapWidth         = _mapWidth,
                TileSize         = _tileSize
            };

            mapParams.MixWith(parameters);
            director.SetupMap(mapParams);
            _map = builder.GetMap();

            _initialized = true;

            _mapObjects = new List <MapObject>();

            DrawChunk(0);
            DrawChunk(1);
            DrawObjects(0);
            DrawObjects(1);
        }
예제 #2
0
        public void MixWith(MapParameters newParams)
        {
            FieldInfo[] fields = typeof(MapParameters).GetFields();
            foreach (var field in fields)
            {
                var oldValue = field.GetValue(this);
                var newValue = field.GetValue(newParams);

                if (newValue != null && newValue != oldValue)
                {
                    field.SetValue(this, newValue);
                }
            }
        }
예제 #3
0
 /// 1 tile is usually 2.56 in world coordinates
 public override void SetMapParams(MapParameters parameters)
 {
     _mapParams = parameters;
 }
예제 #4
0
 public abstract void SetMapParams(MapParameters parameters);
예제 #5
0
 public void SetupMap(MapParameters mapParams)
 {
     _mapBuilder.SetMapParams(mapParams);
 }