public void AddCellGem() { isCellEmpty = false; GameObject cellGemGameObject = Instantiate(cellGemPrefab, Vector3.zero, Quaternion.identity, transform); this.cellGem = cellGemGameObject.GetComponent <CellGem>(); this.cellGem.Init(this, boardDim, CellGemAnimType.Drop); SetGem(); }
void SwapGems(Cell cellOne, Cell cellTwo) { if (showPossibleMoventCoroutine != null) { StopCoroutine(showPossibleMoventCoroutine); } CellGem CellOneGem = cellOne.cellGem; CellGem CellTwoGem = cellTwo.cellGem; finishedToPlace -= 2; cellOne.SetCellGem(CellTwoGem, CellGemAnimType.SimpleMove); cellTwo.SetCellGem(CellOneGem, CellGemAnimType.SimpleMove); this.audio.PlaySwapSound(); SetCanSwap(false); }
protected void InterectionBegan(Vector3 position) { PointerEventData pointerEventData = new PointerEventData(eventSystem); List <RaycastResult> results = new List <RaycastResult>(); initialTouchPos = position; pointerEventData.position = initialTouchPos; graphicRaycaster.Raycast(pointerEventData, results); RaycastResult result = results.FirstOrDefault(r => CellGem.IsGem(r.gameObject.tag)); if (result.gameObject != null) { cell = result.gameObject.transform.parent.gameObject.GetComponent <Cell>(); } }