void ResetInning()
    {
        ballInPlay           = false;
        waitingForNextBatter = false;
        int teamNotBatting = teamAtBat == 0 ? 1 : 0;

        Field.ball.transform.SetParent(GameObject.Find("Field").transform);
        if (curInning.isBottom)
        {
            if (curInning.inningNumber >= numberOfInnings)
            {
                GameOver();
            }
            curInning.inningNumber           += 1;
            curInning.isBottom                = false;
            curInning.pitchesThrownThisInning = 0;
            if (betweenInningControl == null)
            {
                betweenInningControl = FindObjectOfType <BetweenInnings>();
            }
            betweenInningControl.EnableBetweenInningsUI();
        }
        else
        {
            if (curInning.inningNumber >= numberOfInnings)
            {
                if (activeTeams[teamAtBat].score < activeTeams[teamNotBatting].score)
                {
                    GameOver();
                }
            }
            SwitchTeamAtBat();
            curInning.isBottom = true;
        }
        if (curInning.inningNumber == 3)
        {
            if (activeTeams[teamAtBat].score > activeTeams[teamNotBatting].score)
            {
                SwitchTeamAtBat();
            }
        }
        //SwitchTeamAtBat();
        Field.ResetInning();
        outs = 0;
        AddBatterToField();
        SetCameraToFollowBall(false);
    }
Exemple #2
0
 void ResetInning()
 {
     ballInPlay           = false;
     waitingForNextBatter = false;
     Field.ball.transform.SetParent(GameObject.Find("Field").transform);
     if (curInning.isBottom)
     {
         if (curInning.inningNumber >= numberOfInnings)
         {
             GameOver();
         }
         curInning.inningNumber           += 1;
         curInning.isBottom                = false;
         curInning.pitchesThrownThisInning = 0;
         if (betweenInningControl == null)
         {
             betweenInningControl = FindObjectOfType <BetweenInnings>();
         }
         PlayFanfare();
         betweenInningControl.EnableBetweenInningsUI();
     }
     else
     {
         if (curInning.inningNumber >= numberOfInnings)
         {
             if (GetTeamAtBat().score < GetTeamInField().score)
             {
                 GameOver();
             }
         }
         SwitchTeamAtBat();
         curInning.isBottom = true;
     }
     if (curInning.inningNumber == numberOfInnings && curInning.isBottom == false)
     {
         if (GetTeamAtBat().score < GetTeamInField().score)
         {
             SwitchTeamAtBat();
         }
     }
     Field.ResetInning();
     outs = 0;
     AddBatterToField();
     SetCameraToFollowBall(false);
 }