void AddPlayingLinesToSteps(GenSymbolId symbolId, MatrixInWork startMatrix, List <SlotLine> lines, List <MatrixStepBySymbol> linesToPlay, List <string> usedLines) { foreach (var curLine in lines) { foreach (var curCombination in symbolId.symbolConfig.combinations) { if (CheckLineToPrint(curLine, symbolId, curCombination, startMatrix)) { MatrixStepBySymbol newStep = new MatrixStepBySymbol(); newStep.symbolId = symbolId; newStep.matrix = startMatrix; newStep.combination = curCombination; newStep.currentReward = curCombination.reward; newStep.lineCombination = curLine; linesToPlay.Add(newStep); usedLines.Add(curLine.tag); } } } }
SymbolStepResultType FindMatrixForSymbol(int posOnFirstDrum, GenSymbolId symbolId, MatrixInWork startMatrix, float maxEstimateReward, float chanceModificator, List <string> usedLines, out MatrixStepBySymbol result) { result = new MatrixStepBySymbol(); List <GenLineId> linesForIndex = new List <GenLineId>(); foreach (var curLine in lineIdToGenLine.Values) { if (curLine.lineConfig.indexOnDrum[0] == posOnFirstDrum && !usedLines.Contains(curLine.lineConfig.tag) && CheckForAvaliableLine(symbolId, curLine, startMatrix)) { linesForIndex.Add(curLine); } } if (linesForIndex.Count == 0) { return(SymbolStepResultType.NoAvaliableLines); } float maxThreshold = symbolId.symbolConfig.GetMinimumReward() / 2.0f; var chances = CalculateFactorChances(symbolId.symbolConfig.combinations, chanceModificator); SymbolCombination selectedCombination = null; if (symbolId.symbolConfig.combinations[0].reward > (maxEstimateReward + maxThreshold)) { return(SymbolStepResultType.EstimateRewardIsSmall); } else if (Mathf.Abs(symbolId.symbolConfig.combinations[0].reward - maxEstimateReward) < maxThreshold) { selectedCombination = symbolId.symbolConfig.combinations[0]; } while (selectedCombination == null) { SymbolCombination randomCombination = GetRandomCombination(chances); if (randomCombination.reward > (maxEstimateReward + maxThreshold) && chances[0].combination.reward < (maxEstimateReward + maxThreshold)) { continue; } selectedCombination = randomCombination; } Shuffle(linesForIndex); SlotLine resultLine = null; MatrixInWork newMatrix = startMatrix.Copy(); foreach (var curLine in linesForIndex) { if (CheckLineToPrint(curLine.lineConfig, symbolId, selectedCombination, newMatrix)) { PrintSymbolLineToMatrix(curLine.lineConfig, symbolId, selectedCombination, newMatrix); resultLine = curLine.lineConfig; break; } } if (resultLine == null) { return(SymbolStepResultType.LinesNotFound); } result.symbolId = symbolId; result.matrix = newMatrix; result.combination = selectedCombination; result.lineCombination = resultLine; result.currentReward = selectedCombination.reward; return(SymbolStepResultType.Success); }