Esempio n. 1
0
        public Board(int nRow, int nCol)
        {
            m_nRow = nRow;
            m_nCol = nCol;

            m_Cells  = new Cell[nRow, nCol];
            m_Blocks = new Block[nRow, nCol];

            m_Enumerator = new BoardEnumerator(this);
        }
Esempio n. 2
0
        /*
         * 블럭의 컨텍스트(종류, 상태, 카운트, 퀘스트조건 등)에 해당하는 동작을 수행하도록 한다.
         * return 특수블럭이면 true, 그렇지 않으면 false
         */
        public bool DoEvaluation(BoardEnumerator boardEnumerator, int nRow, int nCol)
        {
            //매칭 로직 임시 적용, Qeust 처리 별도 클래스 분리 필요

            Debug.Assert(boardEnumerator != null, $"({nRow},{nCol})");

            if (!IsEvaluatable())
            {
                return(false);
            }

            //1. 매치 상태(클리어 조건 충족)인 경우
            if (status == BlockStatus.MATCH)
            {
                if (questType == BlockQuestType.CLEAR_SIMPLE || boardEnumerator.IsCageTypeCell(nRow, nCol)) //TODO cagetype cell 조건이 필요한가?
                {
                    Debug.Assert(m_nDurability > 0, $"durability is zero : {m_nDurability}");

                    durability--;
                }
                else //특수블럭
                {
                    return(true);
                }

                if (m_nDurability == 0)
                {
                    status = BlockStatus.CLEAR;
                    return(false);
                }
            }

            //2. 클리어 조건에 아직 도달하지 않는 경우 NORMAL 상태로 복귀
            status     = BlockStatus.NORMAL;
            match      = MatchType.NONE;
            matchCount = 0;

            return(false);
        }