Exemplo n.º 1
0
 private void EndSubInning()
 {
     if (InningType == InningTypes.Top)
     {
         InningType = InningTypes.Bottom;
         Outs       = 0;
         WaitBeforeDoing(2f, new WaitBeforeDoingDelegate(ChangeTeams));
     }
     else
     {
         // If there are more innings left OR the game is tied, make another inning
         if (!(Inning + 1 > NumInnings) || HomeScore == VisitorScore)
         {
             InningType = InningTypes.Top;
             Inning    += 1;
             Outs       = 0;
             WaitBeforeDoing(2f, new WaitBeforeDoingDelegate(ChangeTeams));
         }
         else
         {
             // end game
             EndGame();
         }
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// Set up the game variables based on whether this is a new game or a continued game. Always called after start.
    /// </summary>
    /// <param name='gameType'>
    /// Game type.
    /// </param>
    private void SetupGame(bool loadingGame, GameTypes gameType)
    {
        if (loadingGame == false)
        {
            // todo instantiate game class
            Inning     = 1;
            InningType = InningTypes.Top;

            if (gameType == GameTypes.Local)
            {
                CurrentPlayer = 2;                 // if local multiplayer, player 2 bats first
            }
            else
            {
                CurrentPlayer = 1;                 // if single player, player goes before AI
            }

            StartBatter();
        }
        else
        {
            // todo loaded a game
            LoadGame();
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Set up the game variables based on whether this is a new game or a continued game. Always called after start.
    /// </summary>
    /// <param name='gameType'>
    /// Game type.
    /// </param>
    private void SetupGame( bool loadingGame, GameTypes gameType )
    {
        if ( loadingGame == false )
        {
            // todo instantiate game class
            Inning = 1;
            InningType = InningTypes.Top;

            if ( gameType == GameTypes.Local )
            {
                CurrentPlayer = 2; // if local multiplayer, player 2 bats first
            }
            else
            {
                CurrentPlayer = 1; // if single player, player goes before AI
            }

            StartBatter();
        }
        else
        {
            // todo loaded a game
            LoadGame();
        }
    }
Exemplo n.º 4
0
 private void EndSubInning()
 {
     if ( InningType == InningTypes.Top )
     {
         InningType = InningTypes.Bottom;
         Outs = 0;
         WaitBeforeDoing( 2f, new WaitBeforeDoingDelegate( ChangeTeams ) );
     }
     else
     {
         // If there are more innings left OR the game is tied, make another inning
         if ( !(Inning + 1 > NumInnings) || HomeScore == VisitorScore )
         {
             InningType = InningTypes.Top;
             Inning += 1;
             Outs = 0;
             WaitBeforeDoing( 2f, new WaitBeforeDoingDelegate( ChangeTeams ) );
         }
         else
         {
             // end game
             EndGame();
         }
     }
 }