예제 #1
0
파일: BlockWall.cs 프로젝트: thevur0/Tetris
    void NewBlockTeam()
    {
        EnqueueBlockTeam();
        BlockTeam bt = m_BlockTeamQueue.Dequeue();

        InitBlockTeamPos(bt);
        m_CurBlockTeam              = bt;
        m_DropDownBT                = m_CurBlockTeam.Clone();
        m_CurBlockTeam.OnBlockMove += OnCurBlockTeamUpdate;
        m_CurBlockTeam.OnBlockRot  += OnCurBlockTeamUpdate;
        OnCurBlockTeamUpdate();
    }
예제 #2
0
파일: BlockWall.cs 프로젝트: thevur0/Tetris
    public void OnRot()
    {
        if (m_CurBlockTeam == null)
        {
            return;
        }
        BlockTeam bt = m_CurBlockTeam.Clone();

        bt.Rot();
        if (!IsCollide(bt, BT_Move_Type.BTM_None))
        {
            m_CurBlockTeam.Rot();
        }
        else
        {
            BlockTeam btLeft  = bt;
            BlockTeam btRight = bt.Clone();
            for (int i = 0; i < bt.GetBlockWidth(); i++)
            {
                btLeft.MoveLeft();
                if (!IsCollide(btLeft, BT_Move_Type.BTM_None))
                {
                    m_CurBlockTeam.Rot();
                    for (int j = i; j >= 0; j--)
                    {
                        m_CurBlockTeam.MoveLeft();
                    }
                    break;
                }
                btRight.MoveRight();
                if (!IsCollide(btRight, BT_Move_Type.BTM_None))
                {
                    m_CurBlockTeam.Rot();
                    for (int j = i; j >= 0; j--)
                    {
                        m_CurBlockTeam.MoveRight();
                    }
                    break;
                }
            }
        }
    }