private bool AmINeighbourTo(Board_Slot slot) { bool amI = false; if (slot.neighbourhood.nUp == mySlot) { amI = true; } if (slot.neighbourhood.nDown == mySlot) { amI = true; } if (slot.neighbourhood.nLeft == mySlot) { amI = true; } if (slot.neighbourhood.nRight == mySlot) { amI = true; } return(amI); }
public void GemSelected(Board_Slot slot) { if (!moveLock) { draggingGem = true; currentSlot = slot; } }
public void ResetStatus() { moveLock = false; currentSlot = null; targetSlot = null; movedGem01 = null; movedGem02 = null; }
public void ReturnGems() { currentSlot = movedGem01; targetSlot = movedGem02; StartCoroutine(RewindSwap()); AudioController.Audio_PlaySound(0); }
public void SwapGemWith(Board_Slot targetSlot) { if (myGem != null) { myGem.transform.parent = targetSlot.transform; myGem.GoToParent(); targetSlot.ReadGemProperties(); //targetSlot.ScanNeighbours(); myGem = null; } //noGem = false; }
private IEnumerator PerformSwap() { AudioController.Audio_PlaySound(0); movedGem01 = currentSlot; movedGem02 = targetSlot; currentSlot.SwapGemWith(targetSlot); targetSlot.SwapGemWith(currentSlot); currentSlot.ReadGemProperties(); targetSlot.ReadGemProperties(); while (currentSlot.myGem.goingToParent || targetSlot.myGem.goingToParent) { yield return(new WaitForEndOfFrame()); } yield return(StartCoroutine(boardManager.OnMovePerformed())); yield return(null); }
public IEnumerator GenerateBoard() { for (int row = 0; row < boardGrid; row++) { for (int column = 0; column < boardGrid; column++) { yield return(new WaitForEndOfFrame()); // instances GameObject boardSlot = Instantiate(slotPrefab, board); Transform boardSlotTR = boardSlot.GetComponent <Transform>(); Board_Slot boardSlotScript = boardSlot.GetComponent <Board_Slot>(); // Positioning boardSlotTR.localPosition = GetGemPosition(column, row); boardSlot.name = "R" + row.ToString() + " | C " + column; // Indexing mySlots.Add(boardSlotScript); if (row == 0) { boardSlotScript.topSlot = true; } //GemNeration boardSlotScript.CreateGem(Random.Range(0, stageDifficulty)); } } StartCoroutine(DispatchNeighbourhoodCheck()); StartCoroutine(BoardValidation()); yield return(null); }
private void Awake() { mySlot = GetComponent <Board_Slot>(); playerController = FindObjectOfType <Player_Controller>(); boardManager = FindObjectOfType <Board_Manager>(); }
public void AddToArray(Board_Slot slot) { matchArray.Add(slot); }