コード例 #1
0
    /// <summary>
    /// 指定方向の連結妨害パネル数を取得
    /// </summary>
    private int GetDisturbLinkCount(PlayAreaBlock.Dir dir)
    {
        List <PPPanel> links;

        GetDisturbLinks(out links, dir);
        return(links.Count);
    }
コード例 #2
0
ファイル: PPPlayArea.cs プロジェクト: shumat/Giorno
    /// <summary>
    /// パネル交換
    /// </summary>
    public PPPanelBlock SwapPanel(PPPanelBlock block, PlayAreaBlock.Dir dir)
    {
        if (block != null && !block.IsLoced() && block.AttachedPanel != null && !block.AttachedPanel.IsDisturbance)
        {
            PPPanelBlock target = block.GetLink(dir) as PPPanelBlock;
            if (target != null && !target.IsLoced() && !target.GetIsUpperBlockFallWait() && (target.AttachedPanel == null || !target.AttachedPanel.IsDisturbance))
            {
                // 対象ブロックを落下中のパネルが通過中ならキャンセル
                foreach (PPPanel panel in m_UsingPanels)
                {
                    if (panel.IsFalling())
                    {
                        if ((block.TestInsideY(panel.transform.position.y, BlockSize) && block.TestInsideX(panel.transform.position.x, BlockSize, false)) ||
                            (target.TestInsideY(panel.transform.position.y, BlockSize) && target.TestInsideX(panel.transform.position.x, BlockSize, false)))
                        {
                            return(null);
                        }
                    }
                }

                // 交換
                PPPanel t = block.AttachedPanel;
                block.Attach(target.AttachedPanel);
                target.Attach(t);

                // スワップ開始
                if (block.AttachedPanel != null)
                {
                    block.AttachedPanel.BeginSwap(block);
                }
                if (target.AttachedPanel != null)
                {
                    target.AttachedPanel.BeginSwap(target);
                }

                // 移動先の下が空ブロックなら連鎖無効
                PPPanelBlock tempBlock = target.GetLink(PlayAreaBlock.Dir.Down) as PPPanelBlock;
                if (tempBlock != null && tempBlock.AttachedPanel == null)
                {
                    target.AttachedPanel.IgnoreChainSource = true;
                }
                // 空ブロックとの交換なら移動元から上を連鎖無効
                if (block.AttachedPanel == null)
                {
                    tempBlock = block;
                    while ((tempBlock = tempBlock.GetLink(PlayAreaBlock.Dir.Up) as PPPanelBlock) != null && tempBlock.AttachedPanel != null && !tempBlock.AttachedPanel.IsDisturbance)
                    {
                        tempBlock.AttachedPanel.IgnoreChainSource = true;
                    }
                }

                return(target);
            }
        }
        return(null);
    }
コード例 #3
0
    /// <summary>
    /// 指定方向の連結妨害パネルを取得
    /// </summary>
    public void GetDisturbLinks(out List <PPPanel> links, PlayAreaBlock.Dir dir)
    {
        links = new List <PPPanel>();
        PPPanel sidePanel = m_DisturbLinks[(int)dir];         // 隣のパネル

        while (sidePanel != null)
        {
            links.Add(sidePanel);
            sidePanel = sidePanel.m_DisturbLinks[(int)dir];             // 更に隣のパネル
        }
    }
コード例 #4
0
    /// <summary>
    /// パネル入れ替え
    /// </summary>
    private void SwapPanel(PPPanelBlock block, PlayAreaBlock.Dir dir)
    {
        PlayerController.CommandData command = new PlayerController.CommandData();
        command.type   = (byte)PlayerController.CommandType.PP_Swap;
        command.values = new sbyte[2];
        Vector2i grid = (Game as PPGame).PlayArea.GetBlockGrid(block);

        command.values[0] = (sbyte)(grid.y * PPGame.Config.PlayAreaWidth + grid.x);
        command.values[1] = (sbyte)dir;
        SetNextCommand(command);
    }
コード例 #5
0
    /// <summary>
    /// 指定方向の終端の連結妨害パネル取得
    /// </summary>
    private PPPanel GetEndDisturb(PlayAreaBlock.Dir dir)
    {
        PPPanel dest = null;

        if (IsDisturbance)
        {
            PPPanel t = this;
            while (t != null)
            {
                dest = t;
                t    = t.m_DisturbLinks[(int)dir];
            }
        }
        return(dest);
    }