public void LoadBiomaState() { if (biomaState == null) { this.biomaState = GameObject.Find("Bioma").GetComponent <BiomaState>(); } }
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); }
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"); }
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); } }