示例#1
0
    public bool CheckInBuildMap(Int2 Pos)
    {
        if (m_Shape == null)
        {
            return(false);
        }
        List <Int2> l = new List <Int2>();

        for (int layer = 0; layer < m_Shape.height; layer++)
        {
            for (int unit = 0; unit < m_Shape.width; unit++)
            {
                if (m_Shape.GetShapeValue(layer, unit) == 1)
                {
                    l.Add(new Int2(m_cx + unit * MapGrid.m_UnitRoomGridNum + 0, m_cy + layer));
                    l.Add(new Int2(m_cx + unit * MapGrid.m_UnitRoomGridNum + 1, m_cy + layer));
                    l.Add(new Int2(m_cx + unit * MapGrid.m_UnitRoomGridNum + 2, m_cy + layer));
                    l.Add(new Int2(m_cx + unit * MapGrid.m_UnitRoomGridNum + 3, m_cy + layer));
                    l.Add(new Int2(m_cx + unit * MapGrid.m_UnitRoomGridNum + 4, m_cy + layer));
                    l.Add(new Int2(m_cx + unit * MapGrid.m_UnitRoomGridNum + 5, m_cy + layer));
                }
            }
        }
        if (l.Contains(Pos) == true)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#2
0
    protected void JoinMap(int SceneID, Int2 Start, ShapeType Info)
    {
        if (Info == null)
        {
            return;
        }
        List <Int2> l = new List <Int2>();

        for (int layer = 0; layer < Info.height; layer++)
        {
            for (int unit = 0; unit < Info.width; unit++)
            {
                if (Info.GetShapeValue(layer, unit) == 1)
                {
                    for (int i = 0; i <= MapGrid.m_UnitRoomGridNum; i++)
                    {
                        l.Add(new Int2(Start.Unit + unit * MapGrid.m_UnitRoomGridNum + i, Start.Layer + layer));
                    }

                    /*l.Add(new Int2(Start.Unit + unit * MapGrid.m_UnitRoomGridNum + 0, Start.Layer + layer));
                    *  l.Add(new Int2(Start.Unit + unit * MapGrid.m_UnitRoomGridNum + 1, Start.Layer + layer));
                    *  l.Add(new Int2(Start.Unit + unit * MapGrid.m_UnitRoomGridNum + 2, Start.Layer + layer));
                    *  l.Add(new Int2(Start.Unit + unit * MapGrid.m_UnitRoomGridNum + 3, Start.Layer + layer));
                    *  l.Add(new Int2(Start.Unit + unit * MapGrid.m_UnitRoomGridNum + 4, Start.Layer + layer));
                    *  l.Add(new Int2(Start.Unit + unit * MapGrid.m_UnitRoomGridNum + 5, Start.Layer + layer));*/
                }
            }
        }
        //
        foreach (Int2 Pos in l)
        {
            MapGrid Gird = MapGrid.GetMG(Pos);
            if (Gird != null)
            {
                Gird.JoinBuild(m_SceneID);
            }
        }
    }