Exemplo n.º 1
0
 public BalanceInfo(int amount, HitInfo hitInfo = null)
 {
     this.hitInfo = hitInfo;
     this.amount  = amount;
 }
Exemplo n.º 2
0
 public void AddBalance(int amount, HitInfo info = null)
 {
     roundBalance += amount;
     balance      += amount;
     slot.callbacks.onAddBalance.Invoke(new BalanceInfo(amount, info));
 }
Exemplo n.º 3
0
        private void Spin()
        {
            slot.lineManager.allHitHolders.Clear();

            if (gameInfo.bonuses > 0)
            {
                log.totalCost += CostPerSpin(bonusMode);
                gameInfo.bonuses--;
                reels = reelMap[bonusMode];
            }
            else if (gameInfo.freeSpins > 0)
            {
                log.totalCost += CostPerSpin(freeSpinMode);
                gameInfo.freeSpins--;
                reels = reelMap[freeSpinMode];
            }
            else
            {
                log.totalCost += CostPerSpin(defaultMode);
                reels          = reelMap[defaultMode];
            }

            // Draw symbols
            for (int x = 0; x < reelLength; x++)
            {
                int index = Random.Range(0, symbolsPerReel);
                for (int y = 0; y < rows; y++)
                {
                    Symbol symbol = reels[x][index];

                    // Processing scatter hit info.
                    for (int j = 0; j < gameInfo.scatterHitInfos.Count; j++)
                    {
                        HitInfo info = gameInfo.scatterHitInfos[j];
                        if (symbol == info.hitSymbol)
                        {
                            info.hitChains++;
                        }
                    }
                    scores[x][y] = symbol;
                    index++;
                    if (index >= reels[x].Length)
                    {
                        index = 0;
                    }
                }
            }

            for (int j = 0; j < gameInfo.scatterHitInfos.Count; j++)
            {
                ProcessHit(gameInfo.scatterHitInfos[j]);
            }

            // Hit Check
            for (int i = 0; i < lines.Length; i++)
            {
                Line line = lines[i];
                if (line.paths == null)
                {
                    continue;
                }
                for (int x = 0; x < reelLength; x++)
                {
                    if (line.paths[x] < 0 || line.paths[x] >= scores[x].Length)
                    {
                        continue;
                    }
                    symbolsOnPath[x] = scores[x][line.paths[x]];
                }
                line.hitInfo.ParseChains(symbolsOnPath);
                ProcessHit(line.hitInfo);
            }
        }