Example #1
0
        public void UpdateReelWindow(ReelGroup reelGroup, List <int> randomNumbers)
        {
            Window          = new List <List <Symbol> >();
            SymbolPositions = new Dictionary <Symbol, List <SymbolPosition> >();

            // For each reel...
            for (int reelIndex = 0; reelIndex < reelGroup.Reels.Count; ++reelIndex)
            {
                Window.Add(new List <Symbol>());

                int       reelHeight = reelGroup.Reels[reelIndex].Height;
                ReelStrip reelStrip  = reelGroup.Reels[reelIndex].ReelStrip;

                // For each symbol on the reel...
                int randomNumber = randomNumbers[reelIndex];
                for (int offset = 0; offset < reelHeight; ++offset)
                {
                    int stripIndex = (randomNumber + offset) % reelStrip.Symbols.Count;

                    // Add the symbol to the reel window.
                    Symbol symbol = new Symbol(reelStrip.Symbols[stripIndex]);
                    Window[reelIndex].Add(new Symbol(symbol));

                    // Add the symbol position in the dictionary.
                    if (SymbolPositions.ContainsKey(symbol) == false)
                    {
                        SymbolPositions.Add(symbol, new List <SymbolPosition>());
                    }
                    SymbolPositions[symbol].Add(new SymbolPosition {
                        ReelIndex = reelIndex, ReelOffset = offset
                    });
                }
            }
        }
Example #2
0
 /// <summary>
 /// Adds a reel to the reel group.
 /// </summary>
 /// <param name="reelStrip">The reel strip to add.</param>
 /// <param name="reelHeight">The height of the reel window.</param>
 public void AddReel(ReelStrip reelStrip, int reelHeight = 3)
 {
     Reels.Add(
         new ReelProperties
     {
         ReelStrip = reelStrip,
         Height    = (reelStrip.Symbols.Count < reelHeight) ? reelStrip.Symbols.Count : reelHeight
     });
 }