Example #1
0
    public void randomGeneration(float pBouleau = 0.03f, float pSapin = 0.015f)
    {
        for (int i = 0; i < size; ++i)
        {
            for (int j = 0; j < size; ++j)
            {
                GameObject tree = null;
                if (pBouleau >= Main.random())
                {
                    tree = grid[i, j].insert(PlantManager.get().bouleau);
                }
                else if (pSapin >= Main.random())
                {
                    tree = grid[i, j].insert(PlantManager.get().sapin);
                }

                if (tree != null)
                {
                    tree.GetComponent <ArbreDefaut>().setAge((0.4f + 0.7f * Main.random()) * 450.0f);
                }
            }
        }

        for (int i = 0; i < 40; ++i)
        {
            updateCases();
        }
    }
Example #2
0
 public void pointerExit()
 {
     if (!PlantManager.get().isSelected())
     {
         PlantManager.get().buttonDescription(null);
     }
 }
Example #3
0
    public void finishUpdate()
    {
        luminosite = (luminosite * 2 + tmpLuminosite) / 3;
        humidite   = (humidite * 5 + tmpHumidite) / 6;
        fertilite  = (fertilite * 9 + tmpFertilite) / 10;

        // Apparition de fleurs, etc...
        int   nbPlants = PlantManager.get().getNbPlants();
        float l        = getLuminosite();
        float h        = getHumidite();
        float f        = getFertilite();

        for (int i = 0; i < nbPlants; ++i)
        {
            Plant p = PlantManager.get().getPlant(i);
            if (p.toss(l, h, f))
            {
                insert(p);
                //Main.msgApparitionFleur();

                if (i == 9)
                {
                    Main.msgPolypore();
                }
            }
        }

        tmpLuminosite = 0;
        tmpHumidite   = 0;
        tmpFertilite  = 0;
    }
Example #4
0
    public void onClick()
    {
        Main.msgButtonPlant();

        PlantManager.get().setSelectedPlant(plant);

        PlantManager.get().buttonDescription(plant);
    }
Example #5
0
 public static void leaveSelection()
 {
     PlantManager.get().leaveSelection();
     ButtonCut.get().leaveSelection();
     ButtonUproot.get().leaveSelection();
 }