예제 #1
0
        public static CMap Create(IMapLoader loader)
        {
            Int32 width  = loader.GetWidth();
            Int32 height = loader.GetHeight();

            var map = new CMap(width, height);

            for (var x = 0; x < map.Width; x++)
            {
                for (var y = 0; y < map.Height; y++)
                {
                    var   position = new SPoint(x, y);
                    ICell cell     = loader.GetCell(position);
                    map.SetCell(cell);

                    IPositionable unit = loader.GetUnit(position);
                    if (unit != null)
                    {
                        unit.SetMap(map);
                        unit.SetPosition(new SPoint(x, y));
                        //map.Spawn(unit, position.X, position.Y);
                    }
                }
            }

            return(map);
        }