Esempio n. 1
0
        private void NextPlayerRollEvent( )
        {
            Logger.Info("BowlingPlayer :: NextPlayerRollEvent");

            if (_gameRules.IsLastFrame(_currentFrameCounter))
            {
                if (CurrentFrame.IsSpare)
                {
                    if (BonusLastFramesEvent != null)
                    {
                        Logger.Info("BowlingPlayer :: BonusLastFramesEvent");

                        BonusLastFramesEvent.Invoke();
                    }
                }
                if (CurrentFrame.IsStrike)
                {
                    Logger.Info("BowlingPlayer :: HandleStrikeBonus");

                    HandleStrikeBonus();
                }

                if (OnFramesCompleted == null)
                {
                    return;
                }

                Logger.Info("BowlingPlayer :: OnFramesCompleted");

                OnFramesCompleted.Invoke();

                return;
            }

            if (OnFrameComplete != null)
            {
                Logger.Info("BowlingPlayer :: OnFrameComplete");

                OnFrameComplete.Invoke(CurrentFrame);
            }
        }
Esempio n. 2
0
        private void NextFrame()
        {
            if (OnFrameComplete != null)
            {
                OnFrameComplete.Invoke(Frames[currentFrame]);
            }

            currentFrame++;

            if (currentFrame >= Constants.framesPerMatch)
            {
                if (OnFramesCompleted != null)
                {
                    OnFramesCompleted.Invoke();
                }

                return;
            }

            remainingRolls     = 2;
            bonusRollAvailable = IsLastFrame();
        }