Esempio n. 1
0
        public void TestTask2_2()
        {
            Square2    square    = new Square2(3, 4);
            Rectangle2 rectangle = new Rectangle2(5, 7);

            Assert.AreEqual(square.Draw(), square.GetType().Name);
            Assert.AreEqual(rectangle.Draw(), rectangle.GetType().Name);
        }
Esempio n. 2
0
    public void AddRoom(Room r)
    {
        if (r is Square)
        {
            posRooms[rInitialized] = r.PosRoom;
            rInitialized++;
        }
        else if (r is RectangleV)
        {
            RectangleV auxRectangleV = (RectangleV)r;
            for (int i = 0; i <= 1; i++)
            {
                posRooms[rInitialized] = auxRectangleV.posSubRooms[i];
                rInitialized++;
            }
        }
        else if (r is RectangleH)
        {
            RectangleH auxRectangleH = (RectangleH)r;
            for (int i = 0; i <= 1; i++)
            {
                posRooms[rInitialized] = auxRectangleH.posSubRooms[i];
                rInitialized++;
            }
        }
        else if (r is Triangle)
        {
            Triangle auxTriangle = (Triangle)r;
            posRooms[rInitialized] = auxTriangle.PosRoom;
            rInitialized++;

            for (int i = 0; i <= 3; i++)
            {
                if (!auxTriangle.PrevRoom[i])
                {
                    posNoCorr[nCInitialized] = auxTriangle.PosCorridors[i];
                    nCInitialized++;
                }
            }
        }
        else if (r is HexagonalV)
        {
            HexagonalV auxHexagonalV = (HexagonalV)r;
            for (int i = 0; i <= 5; i++)
            {
                posRooms[rInitialized] = auxHexagonalV.PosSubRooms[i];
                rInitialized++;
            }
            for (int i = 0; i <= 7; i++)
            {
                posNoCorr[nCInitialized] = auxHexagonalV.PosCorridors[i];
                nCInitialized++;
            }
        }
        else if (r is HexagonalH)
        {
            HexagonalH auxHexagonalH = (HexagonalH)r;
            for (int i = 0; i <= 5; i++)
            {
                posRooms[rInitialized] = auxHexagonalH.PosSubRooms[i];
                rInitialized++;
            }
            for (int i = 0; i <= 7; i++)
            {
                posNoCorr[nCInitialized] = auxHexagonalH.PosCorridors[i];
                nCInitialized++;
            }
        }
        else if (r is Octagon)
        {
            Octagon auxOctagon = (Octagon)r;
            for (int i = 0; i <= 8; i++)
            {
                posRooms[rInitialized] = auxOctagon.PosSubRooms[i];
                rInitialized++;
            }
            for (int i = 0; i <= 7; i++)
            {
                posNoCorr[nCInitialized] = auxOctagon.PosCorridors[i];
                nCInitialized++;
            }
        }
        else
        {
            Square2 auxSquare2 = (Square2)r;
            for (int i = 0; i <= 3; i++)
            {
                posRooms[rInitialized] = auxSquare2.PosSubRooms[i];
                rInitialized++;
            }
        }
        rooms.Add(r);
        roomCounter++;
    }