Esempio n. 1
0
        /// <summary>
        /// Checks reels for combo as scatter pattern
        /// </summary>
        /// <param name="combo"></param>
        /// <returns></returns>
        public Scatter CheckScatterCombo(WinCombo combo)
        {
            int     count   = 0;
            Scatter scatter = new Scatter();

            for (int i = 0; i < windowWidth && count < combo.maxLength; i++)
            {
                for (int j = 0; j < windowHeight; j++)
                {
                    if (symbolWindow[i, j].gameObject.name == combo.symbol)
                    {
                        count++;
                        var position = new Scatter.Position
                        {
                            x = i,
                            y = j
                        };
                        scatter.positions.Add(position);
                    }
                }
            }

            if (count >= combo.minLength)
            {
                scatter.winAmount = combo.wins[count - combo.minLength];
                scatter.winLength = count;

                return(scatter);
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Checks combo for total line win and saves win amount and length
        /// </summary>
        /// <param name="combo"></param>
        /// <returns></returns>
        public List <Line> CheckLineCombo(WinCombo combo)
        {
            List <Line> lineWins = new List <Line>();

            // Iterate through all lines looking for combos
            for (int i = 0; i < lines.Count; i++)
            {
                // Check line only if bigger win possible
                if (lines[i].winAmount < combo.wins[combo.wins.Length - 1])
                {
                    int length = 0;
                    for (int j = 0; j < windowWidth; j++)
                    {
                        int position = lines[i].position[j];
                        if (symbolWindow[j, position].gameObject.name == combo.symbol)
                        {
                            length++;
                        }
                        else
                        {
                            break;
                        }
                    }

                    // set combo win and win for line
                    if (length >= combo.minLength)
                    {
                        lines[i].winAmount = combo.wins[length - combo.minLength];
                        lines[i].winLength = length;
                        lineWins.Add(new Line(lines[i]));
                        Debug.Log("Line " + i + " Combo Win: " + combo.symbol);
                    }
                }
            }

            return(lineWins);
        }