Example #1
0
    public void AddTutorialContent(List <Scenario> scenarios)
    {
        //now get a random incident data from JSON file
        if (jsonReader == null)
        {
            jsonReader = this.GetComponent <SimplifiedJson>();
        }
        if (_incidentDifficultyManager == null)
        {
            _incidentDifficultyManager = this.GetComponent <IncidentDifficultyManager>();
        }

        foreach (var scenario in scenarios)
        {
            var newIncident = new Incident
            {
                IncidentContent = scenario.Content.Scene,
                Scenario        = scenario,
                TurnToShow      = 0,
            };

            newIncident.TurnToDevelop = 0 + newIncident.IncidentContent.TurnReq + 1;

            //our complete list of incidents
            incidents.Add(newIncident);

            //our list of incidents waiting to show this turn
            NextIncident.Add(newIncident);
            m_IncidentQueue.AddToQueue(newIncident);
        }
    }
    /// <summary>
    /// Get a new incident that the number of officers required is less than or equal to the requirement limit
    /// </summary>
    /// <param name="officerRequirementLimit">Limit of number of officers required for sending to new incident</param>
    /// <returns></returns>
    private Incident GetNewIncident(int officerRequirementLimit, List <Incident> incidents)
    {
        var incident = new Incident();

        if (_incidentLoader == null)
        {
            _incidentLoader = GameObject.Find("TurnManager").GetComponent <SimplifiedJson>();
        }

        //do
        //{

        var location = Location.CurrentLocation;
        var language = DeviceLocation.shouldOverrideLanguage ? DeviceLocation.overrideLanguage.ToString() : "English";

#if ALLOW_DUPLICATE_INCIDENTS
        incident.Scenario = _incidentLoader.CreateNewScenario(location, language);
#else
        incident.Scenario = _incidentLoader.CreateNewScenario(location, language, incidents);
#endif
        //}
        //while (incident.officerIndex == -1 || incident.officer > officerRequirementLimit);

        incident.IncidentContent = incident.Scenario.Content.Scene;

        return(incident);
    }
Example #3
0
    public void CreateNewIncident(int zTurn)
    {
        //now get a random incident data from JSON file
        if (jsonReader == null)
        {
            jsonReader = this.GetComponent <SimplifiedJson>();
        }
        if (_incidentDifficultyManager == null)
        {
            _incidentDifficultyManager = this.GetComponent <IncidentDifficultyManager>();
        }
        // create new incidents, randome amount between 1 and 3

        if (incidents.Count >= MaxIncidents)
        {
            return;
        }

        var location = Location.CurrentLocation;
        var language = DeviceLocation.shouldOverrideLanguage ? DeviceLocation.overrideLanguage.ToString() : "English";

        var newIncident = new Incident();

#if ALLOW_DUPLICATE_INCIDENTS
        jsonReader.CreateNewScenario(location, language);
#else
        jsonReader.CreateNewScenario(location, language, incidents);
#endif
        newIncident.TurnToShow    = zTurn;
        newIncident.TurnToDevelop = zTurn + newIncident.IncidentContent.TurnReq;
        //our complete list of incidents
        incidents.Add(newIncident);
        //our list of incidents waiting to show this turn
        NextIncident.Add(newIncident);
        m_IncidentQueue.AddToQueue(newIncident);
    }