示例#1
0
    public static bool HasSameColor(TileScript[,] mTiles, int pivotRow, int pivotCol, int[,] indexList)
    {
        int rowMax = mTiles.GetLength(0);
        int colMax = mTiles.GetLength(1);

        TileTypeManager.TileColor pivotColor = mTiles[pivotRow, pivotCol].Status.Color;

        for (int i = 0; i < indexList.GetLength(0); i++)
        {
            int currentRow = pivotRow + indexList[i, 0];
            int currentCol = pivotCol + indexList[i, 1];

            if (currentRow < 0 || currentRow >= rowMax || currentCol < 0 || currentCol >= colMax)
            {
                return(false);
            }

            if (mTiles[currentRow, currentCol].Status.Color != pivotColor)
            {
                return(false);
            }
        }

        return(true);
    }
示例#2
0
    public TileStatus(TileTypeManager.TileType type, TileTypeManager.TileColor color)
    {
        mType           = type;
        mColor          = color;
        mCountToDestroy = TileTypeManager.Instance.GetCountToDestroy(mType);
        mMovementSpeed  = TileTypeManager.Instance.GetMovementSpeed(mType);
        mAttackSpeed    = TileTypeManager.Instance.GetAttackSpeed(mType);
        mTurnLeftAttack = 1;

        SetMoveTime();
    }
示例#3
0
    private int mMoveTime;     // moving latest.

    public TileStatus()
    {
        mType           = TypeGenerate();
        mColor          = ColorGenerate();
        mCountToDestroy = TileTypeManager.Instance.GetCountToDestroy(mType);
        mMovementSpeed  = TileTypeManager.Instance.GetMovementSpeed(mType);
        mAttackSpeed    = TileTypeManager.Instance.GetAttackSpeed(mType);
        mTurnLeftAttack = 1;

        SetMoveTime();
    }
示例#4
0
    private bool CheckBlowUpTiles(BlownUpStatus [,] blownUpStatus)
    {
        int  i, j, k;
        bool isBlown     = false;
        int  serialCount = 0;

        TileTypeManager.TileColor startColor = mTiles[0, 0].Status.Color;

        //Right
        for (i = 0; i < MAX_ROW_COUNT; i++)
        {
            serialCount = 0;
            for (j = 0; j < MAX_COL_COUNT; j++)
            {
                if (!mTiles[i, j].IsBlowable)
                {
                    serialCount = 0;
                    continue;
                }
                if (serialCount == 0 || startColor != mTiles[i, j].Status.Color)
                {
                    startColor  = mTiles[i, j].Status.Color;
                    serialCount = 1;
                }
                else
                {
                    serialCount++;
                }
                if (serialCount == BLOW_MINIMUM_COUNT)
                {
                    for (k = 1; k < BLOW_MINIMUM_COUNT; k++)
                    {
                        blownUpStatus[i, j - k].mHorizontal = true;
                        blownUpStatus[i, j - k].mShape      = BlownUpStatus.EffectShape.NONE;
                    }
                    isBlown = true;
                }
                if (serialCount >= BLOW_MINIMUM_COUNT)
                {
                    blownUpStatus[i, j].mHorizontal = true;
                    blownUpStatus[i, j].mShape      = BlownUpStatus.EffectShape.NONE;
                }
            }
        }
        //Down
        for (j = 0; j < MAX_COL_COUNT; j++)
        {
            serialCount = 0;
            for (i = 0; i < MAX_ROW_COUNT; i++)
            {
                if (!mTiles[i, j].IsBlowable)
                {
                    serialCount = 0;
                    continue;
                }
                if (serialCount == 0 || startColor != mTiles[i, j].Status.Color)
                {
                    startColor  = mTiles[i, j].Status.Color;
                    serialCount = 1;
                }
                else
                {
                    serialCount++;
                }
                if (serialCount == BLOW_MINIMUM_COUNT)
                {
                    for (k = 1; k < BLOW_MINIMUM_COUNT; k++)
                    {
                        blownUpStatus[i - k, j].mVertical = true;
                        blownUpStatus[i - k, j].mShape    = BlownUpStatus.EffectShape.NONE;
                    }
                    isBlown = true;
                }
                if (serialCount >= BLOW_MINIMUM_COUNT)
                {
                    blownUpStatus[i, j].mVertical = true;
                    blownUpStatus[i, j].mShape    = BlownUpStatus.EffectShape.NONE;
                }
            }
        }

        int[,] fiveRightIndex = new int[5, 2] {
            { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, { 0, 4 }
        };
        int[,] fiveDownIndex = new int[5, 2] {
            { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 }
        };

        //five
        for (i = 0; i < MAX_ROW_COUNT; i++)
        {
            for (j = 0; j < MAX_COL_COUNT; j++)
            {
                // Horizontal
                if (TileScript.HasSameColor(mTiles, i, j, fiveRightIndex))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, fiveRightIndex, BlownUpStatus.EffectShape.FIVE);
                }
                // Vertical
                if (TileScript.HasSameColor(mTiles, i, j, fiveDownIndex))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, fiveDownIndex, BlownUpStatus.EffectShape.FIVE);
                }
            }
        }

        int[,] L1Index = new int[5, 2] {
            { 0, 0 }, { 0, -1 }, { 0, -2 }, { 1, 0 }, { 2, 0 }
        };
        int[,] L2Index = new int[5, 2] {
            { 0, 0 }, { 0, -1 }, { 0, -2 }, { -1, 0 }, { -2, 0 }
        };
        int[,] L3Index = new int[5, 2] {
            { 0, 0 }, { 0, 1 }, { 0, 2 }, { -1, 0 }, { -2, 0 }
        };
        int[,] L4Index = new int[5, 2] {
            { 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 0 }, { 2, 0 }
        };

        int[,] T1Index = new int[5, 2] {
            { 0, 0 }, { 0, 1 }, { 0, -1 }, { 1, 0 }, { 2, 0 }
        };
        int[,] T2Index = new int[5, 2] {
            { 0, 0 }, { 0, 1 }, { 0, -1 }, { -1, 0 }, { -2, 0 }
        };
        int[,] T3Index = new int[5, 2] {
            { 0, 0 }, { 0, -1 }, { 0, -2 }, { -1, 0 }, { 1, 0 }
        };
        int[,] T4Index = new int[5, 2] {
            { 0, 0 }, { 0, 1 }, { 0, 2 }, { -1, 0 }, { 1, 0 }
        };

        int[,] plusIndex = new int[5, 2] {
            { 0, 0 }, { 0, 1 }, { 0, -1 }, { -1, 0 }, { 1, 0 }
        };
        //Giyeok
        for (i = 0; i < MAX_ROW_COUNT; i++)
        {
            for (j = 0; j < MAX_COL_COUNT; j++)
            {
                // Giyeok and right rotation
                //first Giyeok
                if (TileScript.HasSameColor(mTiles, i, j, L1Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, L1Index, BlownUpStatus.EffectShape.L);
                }
                //second Giyeok
                if (TileScript.HasSameColor(mTiles, i, j, L2Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, L2Index, BlownUpStatus.EffectShape.L);
                }
                // third Giyeok
                if (TileScript.HasSameColor(mTiles, i, j, L3Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, L3Index, BlownUpStatus.EffectShape.L);
                }
                //fourth Giyeok
                if (TileScript.HasSameColor(mTiles, i, j, L4Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, L4Index, BlownUpStatus.EffectShape.L);
                }

                //first T-shape
                if (TileScript.HasSameColor(mTiles, i, j, T1Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, T1Index, BlownUpStatus.EffectShape.L);
                }
                //second T-shape
                if (TileScript.HasSameColor(mTiles, i, j, T2Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, T2Index, BlownUpStatus.EffectShape.L);
                }
                //third T-shape
                if (TileScript.HasSameColor(mTiles, i, j, T3Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, T3Index, BlownUpStatus.EffectShape.L);
                }
                //fourth T-shape
                if (TileScript.HasSameColor(mTiles, i, j, T4Index))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, T4Index, BlownUpStatus.EffectShape.L);
                }

                //plus-shpae
                if (TileScript.HasSameColor(mTiles, i, j, plusIndex))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, plusIndex, BlownUpStatus.EffectShape.L);
                }
            }
        }

        int[,] fourRightIndex = new int[4, 2] {
            { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }
        };
        int[,] fourDownIndex = new int[4, 2] {
            { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 }
        };

        //Four
        for (i = 0; i < MAX_ROW_COUNT; i++)
        {
            for (j = 0; j < MAX_COL_COUNT; j++)
            {
                // Vertical
                if (TileScript.HasSameColor(mTiles, i, j, fourDownIndex))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, fourDownIndex, BlownUpStatus.EffectShape.FOUR);
                }
                // Horizontal
                if (TileScript.HasSameColor(mTiles, i, j, fourRightIndex))
                {
                    BlownUpStatus.SetShape(blownUpStatus, i, j, fourRightIndex, BlownUpStatus.EffectShape.FOUR);
                }
            }
        }

        //None
        return(isBlown);
    }