Exemplo n.º 1
0
    public void Add(MZRoom room)
    {
        rooms[room.id] = room;

        foreach (Vector2Int xy in room.GetCoords())
        {
            if (xy.x < bounds.Left)
            {
                bounds = new MZRect(xy.x, bounds.Top,
                                    bounds.Right, bounds.Bottom);
            }
            if (xy.x >= bounds.Right)
            {
                bounds = new MZRect(bounds.Left, bounds.Top,
                                    xy.x + 1, bounds.Bottom);
            }
            if (xy.y < bounds.Top)
            {
                bounds = new MZRect(bounds.Left, xy.y,
                                    bounds.Right, bounds.Bottom);
            }
            if (xy.y >= bounds.Bottom)
            {
                bounds = new MZRect(bounds.Left, bounds.Top,
                                    bounds.Right, xy.y + 1);
            }
        }
    }
Exemplo n.º 2
0
 public MZDungeon()
 {
     rooms  = new MZIntMap <MZRoom>();
     bounds = new MZRect(Int32.MaxValue, Int32.MaxValue,
                         Int32.MinValue, Int32.MinValue);
 }