コード例 #1
0
    void OnCollisionEnter(Collision col)
    {
        //print (gameObject.name + "  has collided with " + col.gameObject.name);

        if (col.gameObject.name == "Craft")
        {
            //Destroy (this.gameObject);
            GameObject e = (GameObject)Instantiate(Resources.Load("CoinExplosionBurstParticle"), col.contacts[0].point, Quaternion.identity);
            Destroy(e, 2.0f);


            if (Items.coinItems.Count > 0)
            {
                //Destroy (this.gameObject);

                Items.RemoveObjectFromList(this.gameObject, Items.coinItems);

                int pickBuildingIndex = Random.Range(0, GenerateCity.buildingsIndex.Count - 1);
                print("pick " + pickBuildingIndex);

                GenerateCity.buildingsCurrentIndex = pickBuildingIndex;
                GenerateCity.addOneBuilding        = true;

                GenerateCity.RemoveIntFromList(pickBuildingIndex, GenerateCity.buildingsIndex);

                GameManager.coinCollectableItems += 1;
            }
        }
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        cityID = this.gameObject.name[4] - 48;
        int tmpPopulation = populationBase + Random.Range(-2000, 2000);

        city = new GenerateCity(tmpPopulation);
    }
コード例 #3
0
    public override void Effect()
    {
        // do the effect
        string       selectedCityName = "City" + selectedCity.ToString();
        GenerateCity currentCity      = GameObject.Find(selectedCityName).GetComponent <CityScript>().city;

        currentCity.IncreaseEveryoneLoyalty(0.04f);
    }
コード例 #4
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);
         }
     }
 }
コード例 #5
0
    public override void Effect()
    {
        // do the effect
        // Loyalty +4 to everyone. +30% boost to all TV slots and televangelists hired for the next 2 turns.

        string       selectedCityName = "City" + selectedCity.ToString();
        GenerateCity currentCity      = GameObject.Find(selectedCityName).GetComponent <CityScript>().city;

        currentCity.IncreaseEveryoneLoyalty(0.06f);
        // handle cooldown
    }
コード例 #6
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
    }