Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void Loop()
        {
            for (int i = 0; i < 80; ++i)
            {
                if (((i % 15) == 1) && (i != 1))
                {
                    scoreboard.MoveToNextQuarter();
                }
                if (!gameOver)
                {
                    //run
                    Team tip  = cc.TeamInPossession;
                    Team tnip = cc.TeamNotInPossession;
                    int  roll = Dice.Roll("d2");
                    if (roll == 1)//run
                    {
                        Player         ballcarrier = tip.TeamOffense.GetPlayerAtPosition("TB");
                        int            playerIndex = tip.GetIndexOfPlayer(ballcarrier);
                        CarryStatSheet runStats    = (CarryStatSheet)gameStats[tip, playerIndex][StatTypes.Run];
                        RunPlay        run         = new RunPlay(cc, tip, tnip, ballcarrier, runStats);
                        run.Execute();
                    }
                    else
                    {
                        //pass
                        Player thrower = tip.TeamOffense.GetPlayerAtPosition("QB");

                        PassPlay pass = new PassPlay(gameStats, cc);
                        pass.Execute();
                    }
                    Thread.Sleep(TIMER_SLEEP);
                }
            }
            finalScore = this.announcer.ReportFinalScore();
        }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="play"></param>
 /// <param name="isTd"></param>
 /// <param name="isSack"></param>
 /// <param name="isInterception"></param>
 /// <param name="isFumble"></param>
 private void ReportPassPlay(PassPlay play, bool isTd, bool isSack, bool isInterception, bool isFumble)
 {
     if (isTd)
     {
     }
     if (playCompleted != null)
     {
         playCompleted(play.Thrower, play.PrincipalBallcarrier, play.PlayLength, isTd, isSack, isInterception, isFumble);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="play">Play</param>
        /// <param name="isSack">bool</param>
        /// <param name="isInterception">bool</param>
        /// <param name="isFumble">bool</param>
        /// <returns>int</returns>
        public int MoveBallPass(PassPlay play, bool isSack, bool isInterception, bool isFumble)
        {
            MoveChainsVariables var = MoveChains(play, isFumble);

            play.PlayLength = var.playLength;
            if (!var.isTd)
            {
                if (var.isSafety)
                {
                    OnSafetyOccurred(play);
                    if (isFumble)
                    {
                        OnFumbleOccurred(play.Thrower, var.playLength);
                    }
                }
                else
                {
                    if (isFumble)
                    {
                        OnFumbleOccurred(play.Thrower, var.playLength);
                    }
                    else
                    {
                        if (CheckDown() > Down.Fourth)
                        {
                            TurnoverOnDowns();
                        }
                        ReportPassPlay(play, var.isTd, isSack, isInterception, var.isFumble);
                    }
                }
            }
            else
            {
                OnTouchdownScored(play);
            }
            return(var.playLength);
        }