Example #1
0
 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;
     }
 }
Example #2
0
    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;
    }