public void AddConnectedField(PyramidFloorBoardElement field) { if (!connectedFields.Contains(field)) { connectedFields.Add(field); } }
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)); } } }
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(); }
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); } }
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); } } }
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); } }
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; }
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(); }
public virtual void MoveToAndShare(PyramidFloorBoardElement element) { MoveMBECommand cmd = new MoveMBECommand(this, element); PlayerManager.Instance().local.HandleInput(cmd, true); }
public MoveMBECommand(MovingBoardElement element, PyramidFloorBoardElement moveTo) { this.element = element; this.moveTo = moveTo; }
private void SetStartingElement(PyramidFloorBoardElement startElement) { this.startElement = startElement; }
public override void MoveToLocalOnly(PyramidFloorBoardElement element) { standingOn = element; base.MoveToLocalOnly(element); }
public GhostMeeple(GhostPlayer player, PyramidFloorBoardElement standingOn, string UID, int zPosition = defaultZPosition, int meepIdx = 0) : this(player, standingOn.Position, UID, zPosition, meepIdx) { this.standingOn = standingOn; }
public void InitiateQuestionBoardElementMove(PyramidFloorBoardElement floorElementBelow) { isMovingQuestionBoardElement = true; movingQBE = questionElems[floorElems.IndexOf(floorElementBelow)]; movingQBE.SetZPosition(Board.Instance().MaxDepth + 1); }
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; }
public void MoveQuestionElementLocalOnly(QuestionBoardElement questionElement, PyramidFloorBoardElement floorElement) { questionElement.MoveToLocalOnly(floorElement); CommandQueue.Queue(new UpdateFloorElemsToQuestionMove(floorElems, floorElement, questionElems.IndexOf(questionElement))); }
public QuestionBoardElement(PyramidFloorBoardElement below, string UID) : base(below.Position, TextureResources.Get("QM"), UID, below.ZPosition + 1) { }
public override void MoveToLocalOnly(PyramidFloorBoardElement element) { base.MoveToLocalOnly(element); SetZPosition(element.ZPosition + 1); }
public virtual void MoveToLocalOnly(PyramidFloorBoardElement element) { MoveToLocalOnly(element.Position.Location); }
public void AddQuestionBoardElement(QuestionBoardElement element, PyramidFloorBoardElement below) { questionElems.Add(element); floorElems.Add(below); }
public Meeple(Player player, PyramidFloorBoardElement standingOn, string UID, int zPosition = defaultZPosition, int meepidx = 0) : base(player, standingOn, UID, zPosition, meepidx) { this.player = player; }
public void ClickedSomePyramidBoardElement(PyramidFloorBoardElement element) { isMovingQuestionBoardElement = false; MoveQuestionElement(movingQBE, element); movingQBE = null; }
public MoveQBECommand(QuestionBoardElement element, PyramidFloorBoardElement moveTo) { this.element = element; this.moveTo = moveTo; }
public bool HasQuestionAbove(PyramidFloorBoardElement element) { return(floorElems.Contains(element)); }