public int CheckScore(Wheels wheels) { var combinations = from combination in this._combinations orderby combination.Score descending select combination; Wheel[] wheelsToCheck = new Wheel[] { wheels.LeftWheel, wheels.CenterWheel, wheels.RightWheel }; SymbolType[] combinationSymbolTypes = new SymbolType[3]; var sortedWheels = from wheel in wheelsToCheck orderby wheel.Symbol.SymbolType select wheel; foreach (var combination in combinations) { int combinationCount = 0; combinationSymbolTypes[0] = combination.LeftSymbol; combinationSymbolTypes[1] = combination.CenterSymbol; combinationSymbolTypes[2] = combination.RightSymbol; int combinationIndex = 0; foreach (var wheel in sortedWheels) { SymbolType combinationType = combinationSymbolTypes[combinationIndex]; combinationIndex++; if (combinationType == SymbolType.Nothing || wheel.Symbol.SymbolType == combinationType) { if (wheel.Symbol.SymbolType == combinationType) { wheel.GivesScore = true; } combinationCount++; } } if (combinationCount == 3) { return(combination.Score); } else { foreach (Wheel wheel in wheelsToCheck) { wheel.GivesScore = false; } } } return(0); }
public Slot(Canvas rootCanvas, Balder.Core.Application application) { this._application = application; this._rootCanvas = rootCanvas; this._wheels = new Wheels(rootCanvas, application); this._scoreBoardFadeInStoryboard = (Storyboard)rootCanvas.FindName("_scoreBoardFadeInStoryboard"); this._scoreBoardFadeOutStoryboard = (Storyboard)rootCanvas.FindName("_scoreBoardFadeOutStoryboard"); this._stateInfoText = (TextBlock)rootCanvas.FindName("_stateInfoText"); this._gameOver = false; this.LoadAssets(); }