Example #1
0
 protected void WholePopulation(float amount)
 {
     foreach (GameObject c in GameObject.FindGameObjectsWithTag("City"))
     {
         GenerateCity currentCity = c.GetComponent <CityScript>().city;
         for (int i = 0; i <= currentCity.GetPopulation(); i++)
         {
             SetCollectivist(currentCity.populationArray[i], amount);
         }
     }
 }
Example #2
0
    public override void Effect()
    {
        // do the effect
        //  Loyalty+6 to those with loyalty above 50. Loyalty -6 to everyone else.
        string       selectedCityName = "City" + selectedCity.ToString();
        GenerateCity currentCity      = GameObject.Find(selectedCityName).GetComponent <CityScript>().city;

        for (int i = 0; i <= currentCity.GetPopulation(); i++)
        {
            if (currentCity.populationArray[i].loyalty >= 0.5f)
            {
                currentCity.populationArray[i].loyalty += 0.06f;
            }
            else
            {
                currentCity.populationArray[i].loyalty -= 0.06f;
            }
        }

        // handle cooldown
    }