Beispiel #1
0
    void Start()
    {
        //  FactoryVis = Instantiate(FactoryVisualPrefab, transform);
        //   FactoryVis.transform.localPosition = new Vector3(0, 0, 0);
        //FactoryVis.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);

        // Set NumParticles
        double carbonIntensity = MainScript.GetCarbonIntensityByCountry(_countryCode);

        // If carbon intensity is 0, this country is not in the data set and should be disabled
        if (carbonIntensity == 0f)
        {
            SetMaterialColor(COUNTRY_COLOR_INACTIVE);
            Destroy(this);
        }
        else
        {
            NumParticles = (int)(carbonIntensity * _area);

            // Instantiate particle system
            particleObj = Instantiate(GetComponentInParent <ContinentScript>().particleObject, transform, true);
            particleObj.transform.localPosition = new Vector3(0, 0, 0);
            //particleObj.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
            //particleObj.transform.localScale = new Vector3(5.0f, 5.0f, 5.0f);

            // Set stable levels
            if (carbonIntensity < 500f)
            {
                // Clean country
                _stableSmogLevelLow  = carbonIntensity;
                _stableSmogLevelHigh = carbonIntensity + 500f;
                _countryType         = CountryType.CLEAN;
            }
            else
            {
                // Dirty country
                _stableSmogLevelLow  = carbonIntensity - 500f;
                _stableSmogLevelHigh = carbonIntensity + 500f;
                _countryType         = CountryType.DIRTY;
            }

            // Register country with game manager
            MainScript.RegisterCountry(this);
        }
    }