Beispiel #1
0
        public Tilemap(int w, int h, Tilemap ft)
        {
            cmap = new CityMap(w, h);
            map = new Tile[w, h];
            fog = new Fog(w, h);
            name = ft.name;

            startpos = new Point(ft.startpos.X, ft.startpos.Y);

            for (int i = 0; i < w; i++)
                for (int e = 0; e < h; e++)
                {
                    if (i < ft.NumX && e < ft.NumY)
                    {
                        map[i, e] = ft.get(i, e);
                        fog.set(i, e, ft.Fog.get(i, e));
                        cmap.set(i, e, ft.CityMap.get(i, e));
                    }
                    else if (i < w && e < h)
                    {
                        map[i, e] = new Tile();
                        fog.set(i, e, false);
                    }
                }
        }
Beispiel #2
0
        public CityMap clone()
        {
            CityMap ret = new CityMap(NumX, NumY);

            for (int i = 0; i < cmap.GetLength(0); i++)
                for (int e = 0; e < cmap.GetLength(1); e++)
                    if(cmap[i, e]!=null)
                        ret.set(i, e, cmap[i, e].clone());

            return ret;
        }
        public static CityMap citymap(XmlElement e)
        {
            CityMap cmap = new CityMap(int.Parse(e.GetAttribute("numx")), int.Parse(e.GetAttribute("numy")));

            Point p;

            foreach (XmlElement ce in e.ChildNodes)
                if (ce.Name == "Pos")
                {
                    p = pos(ce);
                    cmap.set(p.X, p.Y, city(ce["City"]));
                }

            return cmap;
        }