Ejemplo n.º 1
0
    public void NextTurn()
    {
        //PlayerPrefs.DeleteAll();
        AudioManager.Instance.PlayNextTurn();

        turn++;
        NextTurnButton.SetActive(false);
        EndTurnSatisfaction.SetActive(false);
        GameObject.Find("OfficerManager").GetComponent <OfficerController>().EndTurn();
        turnsText.text = turn.ToString();
        if (_incidentManager == null)
        {
            _incidentManager = this.GetComponent <IncidentManager>();
        }

        _incidentManager.UpdateIncidents();
        //m_IncidentManager.CheckExpiredIncidents(turn);

        if (_incidentManager.IsGameOver())
        {
            //GAME OVER
            GameOver.gameObject.SetActive(true);
            GameOver.ShowGameOver(turn - 1, _incidentManager.GetTotalCasesClosed(), _incidentManager.GetTotalCasesClosedWell());
        }
        else
        {
            //update at the end to give the player a chance to get citizen happiness over 20%
            _incidentManager.EndTurn();
            //decide which incident to show this turn
            _incidentManager.IsIncidentWaitingToShow(turn);    //not using the bool callback to populate the next incident list
                                                               //_incidentManager.CreateNewIncident(turn);

            _incidentManager.AddNewIncidents(turn);


#if SELECT_INCIDENTS
            GameObject.Find("IncidentDialog").GetComponent <DialogBox>().DeactivateAll();
#else
            _incidentManager.ShowIncident(turn);
#endif
        }
    }