Esempio n. 1
0
    // Function that swap two TobleFoods
    public void FlipGems(TobleGem one, TobleGem two, bool flipflipped, bool gravity)
    {
        if (one == null)
        {
            return;
        }
        if (two != null)
        {
            if (!gravity)
            {
                SFXManager.instance.PlaySFX(Swap);
            }
            // Swap their coordinates
            int aux_x = one.x;
            int aux_y = one.y;
            one.x = two.x;
            one.y = two.y;
            two.x = aux_x;
            two.y = aux_y;

            tiles[one.x, one.y] = one.gameObject;
            tiles[two.x, two.y] = two.gameObject;

            // Update their movement
            update.Add(one);
            update.Add(two);

            // If there is no matches and the swapped toblefoods need to swap back
            if (flipflipped)
            {
                flipped.Add(new FlippedGems(one, two));
            }
        }
        else
        {
            // Reset the position of a TobleFood and update it
            one.ResetPosition();
            update.Add(one);
        }
    }
Esempio n. 2
0
 // Function that reset the position of a TobleFood and update it
 public void ResetGem(TobleGem gem)
 {
     gem.ResetPosition();
     update.Add(gem);
 }