Beispiel #1
0
    protected void AddRegularConnections()
    {
        for (int f = 0; f < floors.Length; f++)
        {
            PyramidFloor floor = floors[f];
            for (int i = 0; i < floor.elements.Count; i++)
            {
                int next = i == floor.elements.Count - 1 ? 0 : i + 1;
                int past = i == 0 ? floor.elements.Count - 1 : i - 1;

                floor.elements[i].AddConnectedField(floor.elements[next]);
                floor.elements[i].AddConnectedField(floor.elements[past]);
                visibleConnections.Add(new PyramidFloorBoardElementConnector(floor.elements[i], floor.elements[next], "regularcon_floor" + f.ToString() + i.ToString() + next.ToString(), floor.elements[i].ZPosition - 1));
            }
        }
    }
Beispiel #2
0
    public void BuildPyramidInSpace()
    {
        boardUnit = space.Width / boardUnitCount;

        floorRects[0] = new Rectangle(1, 1, 13, 13);
        floorRects[1] = new Rectangle(3, 3, 9, 9);
        floorRects[2] = new Rectangle(5, 5, 5, 5);
        floorRects[3] = new Rectangle(7, 7, 1, 1);

        backgroundRects[0] = new Rectangle(0, 0, 15, 15);
        backgroundRects[1] = new Rectangle(2, 2, 11, 11);
        backgroundRects[2] = new Rectangle(4, 4, 7, 7);
        backgroundRects[3] = new Rectangle(6, 6, 3, 3);

        floors[0] = new PyramidFloorDoubleCorner(7, floorRects[0], 4);
        floors[1] = new PyramidFloor(5, floorRects[1], 5);
        floors[2] = new PyramidFloor(4, floorRects[2], 6);
        foreach (PyramidFloor floor in floors)
        {
            CommandQueue.Queue(new AddToBoardCommand(floor.elements.ToArray()));
        }

        winningField = new PyramidFloorBoardElement(ToAbsolute(floorRects[3]), "winningfield", 1);
        CommandQueue.Queue(new AddToBoardCommand(winningField));

        // setting background images
        for (int i = 1; i <= 4; i++)
        {
            string backgroundName = "PyramidBackgroundFloor" + i;
            StaticVisibleBoardElement background = new StaticVisibleBoardElement(ToAbsolute(backgroundRects[i - 1]), TextureResources.Get(backgroundName), backgroundName, i != 4 ? i : 8);
            CommandQueue.Queue(new AddToBoardCommand(background));
        }

        AddElevationConnections();
        AddRegularConnections();
        MakeConnectionsVisible();
        PlaceQuestionmarks();
    }