public void SetCellSwapEnter(HexagonalCell _cell) { if (isNeedActivateBonus && currentActivSlot != null && currentActivSlot.GetBonus() == eSpecialCard.swap && swapCell != null) { if (!HexagonalGrid.Instance.GetNearFullCells(swapCell.Info.myX, swapCell.Info.myY).Contains(_cell)) { swapCell = null; return; } SoundManager.Instance.PlayBonusStart(eSpecialCard.swap, false); GlobalInfo.canCombination = false; CardData swapCard = new CardData(); swapCard.myColor = swapCell.GetCard().Info.myColor; swapCard.myNumCard = swapCell.GetCard().Info.myNumCard; swapCard.mySpecialCard = swapCell.GetCard().Info.mySpecialCard; swapCard.isClosed = swapCell.GetCard().GetIsClosed(); swapCell.GetCard().SetMovePositionCallBack(_cell.transform.position, (delegate() { swapCell.InitCardInCellWithCheckClosed((int)_cell.GetCard().Info.myColor, _cell.GetCard().Info.myNumCard, _cell.GetCard().Info.mySpecialCard, _cell.GetCard().GetIsClosed()); })); _cell.GetCard().SetMovePositionCallBack(swapCell.transform.position, (delegate() { _cell.InitCardInCellWithCheckClosed((int)swapCard.myColor, swapCard.myNumCard, swapCard.mySpecialCard, swapCard.isClosed); swapCell = null; ManagerCombination.Instance.ClearMatchCells(); GlobalInfo.canCombination = true; })); currentActivSlot.ClearSlot(); } }
public void ActivatePanel(HexagonalCell _cell) { currentCell = _cell; panel.SetActive(true); eCards color = currentCell.GetCard().Info.myColor; bubna.SetActive(true); chirwa.SetActive(true); cross.SetActive(true); pika.SetActive(true); if (color == eCards.Bubna) { bubna.SetActive(false); } if (color == eCards.Chirwa) { chirwa.SetActive(false); } if (color == eCards.Cross) { cross.SetActive(false); } if (color == eCards.Pika) { pika.SetActive(false); } }
private void CreateClosedCardNearFull() { int lenght = ManagerCombination.Instance.GetLenghtAllCombination(); for (int i = 0; i < lenght; i++) { HexagonalCell _cell = HexagonalGrid.Instance.GetRandomEmptyCellNearFull(); if (_cell != null) { CardData _card = PollCards.Instance.GetNewCard(); _cell.InitCardInCell((int)_card.myColor, _card.myNumCard, _card.mySpecialCard); _cell.GetCard().SetIsClosed(true); } } currentProgress = 0; }
private void MechanicsBonuses(HexagonalCell _cell) { SoundManager.Instance.PlayBonusStart(currentBonus, false); string strCurrentBonus = currentBonus.ToString(); if (strCurrentBonus.Contains("upend")) { isNeedActivateBonus = true; if (!_cell.GetCard().GetIsClosed()) { return; } currentActivSlot.ActivateBackImageCard(true); _cell.SetFlashingBack(false); _cell.GetCard().SetIsClosed(false); canUppend--; ManagerCombination.Instance.ClearMatchCells(); if (canUppend <= 0) { currentActivSlot.ClearSlot(); isNeedActivateBonus = false; HexagonalCell[] closedCells = HexagonalGrid.Instance.GetAllClosedCard(); for (int i = 0; i < closedCells.Length; i++) { closedCells[i].SetFlashingBack(false); } } } else if (strCurrentBonus.Contains("wind")) { int step = 0; if (currentBonus == eSpecialCard.wind1) { step = 1; } if (currentBonus == eSpecialCard.wind2) { step = 2; } if (currentBonus == eSpecialCard.wind3) { step = 3; } currentActivSlot.GetMyCard().SetMovePositionCallBack(_cell.transform.position, (delegate() { HexagonalGrid.Instance.WindFallNearCard(_cell.Info.myX, _cell.Info.myY, step); BonusManager.Instance.ClearCurrentBonusSlot(); ManagerCombination.Instance.ClearMatchCells(); activCard.SetEnableImageCard(true); })); } else if (strCurrentBonus.Contains("fireworks")) { int step = 0; if (currentBonus == eSpecialCard.fireworks2) { step = 1; } if (currentBonus == eSpecialCard.fireworks3) { step = 2; } currentActivSlot.GetMyCard().SetMovePositionCallBack(_cell.transform.position, (delegate() { HexagonalGrid.Instance.FallNearCard(_cell.Info.myX, _cell.Info.myY, step); BonusManager.Instance.ClearCurrentBonusSlot(); ManagerCombination.Instance.ClearMatchCells(); activCard.SetEnableImageCard(true); })); } else if (currentBonus == eSpecialCard.copy && !_cell.GetCard().GetIsClosed()) { if (!activCard.GetIsMoving()) { activCard.AppearanceInit((int)_cell.GetCard().Info.myColor, _cell.GetCard().Info.myNumCard, eSpecialCard.none); currentActivSlot.ClearSlot(); } } else if (currentBonus == eSpecialCard.chameleon && !_cell.GetCard().GetIsClosed() && _cell.GetCard().Info.mySpecialCard == eSpecialCard.none) { chameleonPanel.ActivatePanel(_cell); currentActivSlot.ClearSlot(); } else if (currentBonus == eSpecialCard.decrease && !_cell.GetCard().GetIsClosed() && _cell.GetCard().Info.myNumCard > 2) { _cell.GetCard().DecreaseCard(); currentActivSlot.ClearSlot(); } else if (currentBonus == eSpecialCard.increase && !_cell.GetCard().GetIsClosed() && _cell.GetCard().Info.myNumCard < 14) { _cell.GetCard().IncreaseCard(); currentActivSlot.ClearSlot(); } }
public void SetNewChirwa() { panel.SetActive(false); currentCell.InitCardInCell((int)eCards.Chirwa, currentCell.GetCard().Info.myNumCard, eSpecialCard.none); ManagerCombination.Instance.ClearMatchCells(); }
private void CheckCardsIn5Cells(int _x, int _y) { List <Card> _cardsX = new List <Card>(); List <Card> _cardsY = new List <Card>(); List <Card> _cardsYX = new List <Card>(); for (int i = 0; i < 5; i++) { HexagonalCell _cell = HexagonalGrid.Instance.GetCell(_x + i, _y); if (_cell != null && _cell.GetIsFull() && !_cell.GetCard().GetIsClosed()) { _cardsX.Add(_cell.GetCard()); } else { break; } } int myXminus = _x; int myYleft = _y; for (int i = 0; i < 5; i++) { if (i > 0) { if ((myYleft + i) % 2 == 0) { } else { myXminus--; } } HexagonalCell _cell = HexagonalGrid.Instance.GetCell(myXminus, myYleft + i); if (_cell != null && _cell.GetIsFull() && !_cell.GetCard().GetIsClosed()) { _cardsY.Add(_cell.GetCard()); } else { break; } } int myXplus = _x; int myYright = _y; for (int i = 0; i < 5; i++) { if (i > 0) { if ((myYright + i) % 2 == 0) { myXplus++; } } HexagonalCell _cell = HexagonalGrid.Instance.GetCell(myXplus, myYright + i); if (_cell != null && _cell.GetIsFull() && !_cell.GetCard().GetIsClosed()) { _cardsYX.Add(_cell.GetCard()); } else { break; } } CheckCombinationIn5Cards(_cardsX.ToArray()); CheckCombinationIn5Cards(_cardsY.ToArray()); CheckCombinationIn5Cards(_cardsYX.ToArray()); }