public void ReadBoard() { for (int i = 0; i < transform.childCount; i++) { GemBehaviour gem = transform.GetChild(i).GetComponent <GemBehaviour>(); Vector2 index = gem.GetTileIndex(); orbBoard[(int)index.x, (int)index.y] = gem; } }
private void OnTriggerEnter2D(Collider2D collision) { if (!orbPicked) { return; } //if (lastSwapped == collision.gameObject) return; GemBehaviour neighbour = collision.GetComponent <GemBehaviour>(); Vector2 newTilePos = neighbour.GetTileIndex(); neighbour.SetTilePosition(indexOnBoard); neighbour.ApplyPositionOnBoard(); indexOnBoard = newTilePos; }