Ejemplo n.º 1
0
    /// <summary>
    /// 縦方向に繋がった同タイプドロップ数を取得
    /// </summary>
    public void GetVerticallMatchDropCount(out int count, out int validVanishCount, out bool existsPushedDrop, out bool forceVanish)
    {
        count            = 0;
        validVanishCount = 0;
        existsPushedDrop = false;
        forceVanish      = false;

        if (AttachedDrop == null)
        {
            return;
        }

        PlayAreaBlock block = this;
        MDDrop        drop  = null;
        Dir           dir   = Dir.Up;

        for (int i = 0; i < 2; i++)
        {
            while (block != null)
            {
                drop = (block as MDDropBlock).AttachedDrop;
                if (drop != null && drop.DropType == AttachedDrop.DropType && !drop.IsLocked())
                {
                    ++count;

                    if (drop.IsValidVanish)
                    {
                        ++validVanishCount;
                    }
                    if (drop.IsPushed)
                    {
                        existsPushedDrop = true;
                    }
                    if (drop.IsMatchPushed)
                    {
                        forceVanish = true;
                    }

                    block = block.GetLink(dir);
                }
                else
                {
                    break;
                }
            }

            dir   = Dir.Down;
            block = GetLink(dir);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// ドロップをプル
    /// </summary>
    public bool PullDrop(int row)
    {
        if (row < 0 || row >= Width || !IsValidPull(row))
        {
            return(false);
        }

        int count = 0;
        // 最下段のドロップがあるブロックを取得
        MDDropBlock block = GetMostUnderFullBlock(row, false);

        if (block != null)
        {
            MDDrop drop = null;
            while (block != null && block.IsAttachOrReserved)
            {
                bool reserveDrop = block.ReservedDrop != null;
                drop = reserveDrop ? block.ReservedDrop : block.AttachedDrop;
                if ((!drop.IsLocked() || reserveDrop) && (m_PulledDrop.Count == 0 || drop.DropType == m_PulledDrop[0].DropType))
                {
                    if (reserveDrop)
                    {
                        drop.CancelState();
                        block.CancelReserve();
                    }
                    else
                    {
                        block.Detach();
                    }

                    drop.BeginPull(Game.Player as MDPlayer);

                    m_PulledDrop.Add(drop);

                    block = block.GetLink(PlayAreaBlock.Dir.Up) as MDDropBlock;
                    ++count;
                }
                else
                {
                    break;
                }
            }
        }

        return(count > 0);
    }