Example #1
0
 public void AddConnectedField(PyramidFloorBoardElement field)
 {
     if (!connectedFields.Contains(field))
     {
         connectedFields.Add(field);
     }
 }
Example #2
0
    protected void AddElevationConnections()
    {
        for (int i = 0; i < floors.Length; i++)
        {
            for (int f = 0; f < floors[i].elevationFromIndices.Count; f++)
            {
                PyramidFloorBoardElement from = floors[i].elements[floors[i].elevationFromIndices[f]];
                PyramidFloorBoardElement to;

                if (i + 1 < floors.Length)
                {
                    from = floors[i].elements[floors[i].elevationFromIndices[f]];
                    to   = floors[i + 1].elements[floors[i + 1].elevationToIndices[f]];
                }
                else
                {
                    from = floors[i].elements[floors[i].elevationFromIndices[f]];
                    to   = winningField;
                }

                to.AddConnectedField(from);
                from.AddConnectedField(to);
                visibleConnections.Add(new PyramidFloorBoardElementConnector(from, to, "elevationcon_floor" + i + "_" + to.UID + "to" + from.UID, from.ZPosition - 1));
            }
        }
    }
Example #3
0
    protected override void CreateFieldsInDirection(Direction direction)
    {
        CreatePointFor createPointFunc = DecideCreatePointForFunc(direction);
        int            max             = fieldElemsCount;

        for (int i = 0; i < max; i++)
        {
            PyramidFloorBoardElement newElem = new PyramidFloorBoardElement(Board.Instance().ToAbsolute(createPointFunc(i), fieldSizeInBU), "pyramidfloor" + fieldElemsCount + "_elem_" + direction.ToString() + i.ToString(), elementsZPos);
            elements.Add(newElem);
        }
    }
    public PyramidFloorBoardElementConnector(PyramidFloorBoardElement from, PyramidFloorBoardElement to, string UID, int zPosition = 0) :
        base(
            from.Position,
            TextureResources.Get("PyramidFieldConnectionShort"),
            UID,
            zPosition
            )
    {
        this.fromBE = from;
        this.toBE   = to;

        Setup();
    }
Example #5
0
 public override void MoveToLocalOnly(PyramidFloorBoardElement element)
 {
     base.MoveToLocalOnly(element);
     if (QuestionManager.Instance().HasQuestionAbove(element))
     {
         QuestionManager.Instance().AskRandom(OnQuestionAnswered);
     }
     if (element.Equals(Board.Instance().winningField))
     {
         hasWon = true;
         Game1.OnGameOver(this);
     }
 }
Example #6
0
    private void PlaceQuestionmarks()
    {
        for (int x = 0; x < questionMarkIndices.Length; x++)
        {
            for (int y = 0; y < questionMarkIndices[x].Length; y++)
            {
                PyramidFloorBoardElement floorElem    = floors[x].elements[questionMarkIndices[x][y]];
                QuestionBoardElement     questionElem = new QuestionBoardElement(floorElem, "floor" + x + "_qbe" + y);

                CommandQueue.Queue(new AddToBoardCommand(questionElem));
                QuestionManager.Instance().AddQuestionBoardElement(questionElem, floorElem);
            }
        }
    }
Example #7
0
    public static MoveGMCommand FromInput(SerializableCommand sCommand)
    {
        try
        {
            GhostMeeple movingEl             = (GhostMeeple)Board.Instance().FindByUID(sCommand.UID);
            PyramidFloorBoardElement floorEl = (PyramidFloorBoardElement)Board.Instance().FindByUID(sCommand.body);

            return(new MoveGMCommand(movingEl, floorEl));
        }
        catch (InvalidCastException ice)
        {
            Console.WriteLine(ice.Message);
            return(null);
        }
    }
Example #8
0
    private void Initiate(Meeple meeple)
    {
        this.meeple = meeple;
        this.start  = meeple.standingOn;
        startCenter = start.Position.Center.ToVector2();
        curArrow    = new ArrowAnimatable(start.Position, "movementarrow", start.ZPosition + 1);
        CommandQueue.Queue(new AddToBoardCommand(curArrow));

        // build direction vectors to each connected field
        directions = new Vector2[start.connectedFields.Count];
        for (int i = 0; i < directions.Length; i++)
        {
            directions[i] = start.connectedFields[i].Position.Center.ToVector2() - startCenter;
            directions[i].Normalize();
        }

        isActive  = true;
        initiated = DateTime.Now;
    }
Example #9
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();
    }
Example #10
0
    public virtual void MoveToAndShare(PyramidFloorBoardElement element)
    {
        MoveMBECommand cmd = new MoveMBECommand(this, element);

        PlayerManager.Instance().local.HandleInput(cmd, true);
    }
Example #11
0
 public MoveMBECommand(MovingBoardElement element, PyramidFloorBoardElement moveTo)
 {
     this.element = element;
     this.moveTo  = moveTo;
 }
Example #12
0
 private void SetStartingElement(PyramidFloorBoardElement startElement)
 {
     this.startElement = startElement;
 }
Example #13
0
 public override void MoveToLocalOnly(PyramidFloorBoardElement element)
 {
     standingOn = element;
     base.MoveToLocalOnly(element);
 }
Example #14
0
 public GhostMeeple(GhostPlayer player, PyramidFloorBoardElement standingOn, string UID, int zPosition = defaultZPosition, int meepIdx = 0) : this(player, standingOn.Position, UID, zPosition, meepIdx)
 {
     this.standingOn = standingOn;
 }
Example #15
0
 public void InitiateQuestionBoardElementMove(PyramidFloorBoardElement floorElementBelow)
 {
     isMovingQuestionBoardElement = true;
     movingQBE = questionElems[floorElems.IndexOf(floorElementBelow)];
     movingQBE.SetZPosition(Board.Instance().MaxDepth + 1);
 }
Example #16
0
 public MoveGMCommand(GhostMeeple element, PyramidFloorBoardElement moveTo)
 {
     this.element = element;
     this.moveTo  = moveTo;
 }
 public UpdateFloorElemsToQuestionMove(List <PyramidFloorBoardElement> floorElements, PyramidFloorBoardElement updated, int index)
 {
     this.floorElements = floorElements;
     this.updated       = updated;
     this.index         = index;
 }
Example #18
0
 public void MoveQuestionElementLocalOnly(QuestionBoardElement questionElement, PyramidFloorBoardElement floorElement)
 {
     questionElement.MoveToLocalOnly(floorElement);
     CommandQueue.Queue(new UpdateFloorElemsToQuestionMove(floorElems, floorElement, questionElems.IndexOf(questionElement)));
 }
Example #19
0
 public QuestionBoardElement(PyramidFloorBoardElement below, string UID)
     : base(below.Position, TextureResources.Get("QM"), UID, below.ZPosition + 1)
 {
 }
Example #20
0
 public override void MoveToLocalOnly(PyramidFloorBoardElement element)
 {
     base.MoveToLocalOnly(element);
     SetZPosition(element.ZPosition + 1);
 }
Example #21
0
 public virtual void MoveToLocalOnly(PyramidFloorBoardElement element)
 {
     MoveToLocalOnly(element.Position.Location);
 }
Example #22
0
 public void AddQuestionBoardElement(QuestionBoardElement element, PyramidFloorBoardElement below)
 {
     questionElems.Add(element);
     floorElems.Add(below);
 }
Example #23
0
 public Meeple(Player player, PyramidFloorBoardElement standingOn, string UID, int zPosition = defaultZPosition, int meepidx = 0) : base(player, standingOn, UID, zPosition, meepidx)
 {
     this.player = player;
 }
Example #24
0
 public void ClickedSomePyramidBoardElement(PyramidFloorBoardElement element)
 {
     isMovingQuestionBoardElement = false;
     MoveQuestionElement(movingQBE, element);
     movingQBE = null;
 }
Example #25
0
 public MoveQBECommand(QuestionBoardElement element, PyramidFloorBoardElement moveTo)
 {
     this.element = element;
     this.moveTo  = moveTo;
 }
Example #26
0
 public bool HasQuestionAbove(PyramidFloorBoardElement element)
 {
     return(floorElems.Contains(element));
 }