Пример #1
0
 public void LoadBiomaState()
 {
     if (biomaState == null)
     {
         this.biomaState = GameObject.Find("Bioma").GetComponent <BiomaState>();
     }
 }
Пример #2
0
    private void DecreasePlantAttributes()
    {
        float soilNutrients = 100f;
        float soilHumidity  = 50f;

        DecreaseAttribute(Attributes.SOIL_NUTRIENTS, soilNutrients / DECREASE_WEIGHT);

        BiomaState biomaState  = getBiomaState();
        float      temperature = biomaState.biomaAttributes[Attributes.TEMPERATURE];

        DecreaseAttribute(Attributes.SOIL_HUMIDITY, (soilHumidity + temperature) / DECREASE_WEIGHT);
    }
Пример #3
0
    public void LoadScene(Text name)
    {
        GameObject biomaGameObject = new GameObject("Bioma");
        Bioma      bioma           = GetBiomaByName(name.text);

        BiomaController controller = biomaGameObject.AddComponent <BiomaController>();

        controller.bioma      = bioma;
        controller.plantsList = plants;

        BiomaState state = biomaGameObject.AddComponent <BiomaState>();

        state.bioma = bioma;

        DontDestroyOnLoad(controller);
        DontDestroyOnLoad(state);
        SceneManager.LoadScene("Bioma");
    }
Пример #4
0
    private float GetLifeUpdateValue()
    {
        BiomaState biomaState = getBiomaState();

        float distanceCount = 0;

        distanceCount += GetDistance(biomaState.biomaAttributes);
        distanceCount += GetDistance(plantAttributes);
        //Debug.Log("Distance: " + distanceCount);
        distanceCount = distanceCount * Time.deltaTime;

        bool hasDamage = distanceCount > 0;

        if (hasDamage)
        {
            return(-distanceCount);
        }
        else
        {
            var   attributesCount = Enum.GetNames(typeof(Attributes)).Length;
            float recoveryLife    = attributesCount * LIFE_RECOVERY_FACTOR;
            return(recoveryLife * Time.deltaTime);
        }
    }