private void UpdateFieldBanish(ref FieldBanish fieldBanish, int x, int y, int combo) { fieldBanish.phase = EnumBanishPhase.BanishStart; fieldBanish.count = 0; fieldBanish.combo = combo; fieldBanishs[0] = fieldBanish; }
private void UpdateBanish() { FieldBanish fieldBanish = fieldBanishs[0]; fieldBanish.phase = EnumBanishPhase.Fall; fieldBanishs[0] = fieldBanish; }
private void CheckLine(ref FieldBanish fieldBanish) { var fieldInput = fieldInputs[0]; if (!fieldInput.isOnGrid) { return; } int nextCombo = fieldBanish.combo + 1; for (int x = 0; x < GridRowLength; x++) { for (int y = 0; y < GridColumnLength; y++) { checkStates[y] = pieceStates[gridStates[x + GridRowLength * y].pieceId]; } bool isSameColor = CheckLine(checkStates, GridColumnLength, nextCombo); if (isSameColor) { UpdateFieldBanish(ref fieldBanish, x, 0, nextCombo); int col = 0; for (int y = 0; y < GridColumnLength; y++) { int index = gridStates[x + GridRowLength * y].pieceId; PieceState pieceState = pieceStates[index]; UpdatePieceStateAndEffectState(ref pieceState, col, index, nextCombo); col++; } } } for (int y = 0; y < GridColumnLength; y++) { for (int x = 0; x < GridRowLength; x++) { checkStates[x] = pieceStates[gridStates[x + GridRowLength * y].pieceId]; } bool isSameColor = CheckLine(checkStates, GridRowLength, nextCombo); if (isSameColor) { int col = 0; UpdateFieldBanish(ref fieldBanish, 0, y, nextCombo); for (int x = 0; x < GridRowLength; x++) { int index = gridStates[x + GridRowLength * y].pieceId; PieceState pieceState = pieceStates[index]; UpdatePieceStateAndEffectState(ref pieceState, col, index, nextCombo); col++; } } } if (fieldBanish.phase == EnumBanishPhase.BanishEnd) { fieldBanish.phase = EnumBanishPhase.FallStart; fieldBanish.combo = 0; fieldBanishs[0] = fieldBanish; } }