protected override void Tick(object sender, S_World.OnTickEventArgs e) { base.Tick(sender, e); text.GetComponent <TextMesh>().text = "L:" + level + " Le:" + energy["life"]; if (tick % growTicks == 0) { int lifeLevelToAdd = 0; // Energy from distance to water if (S_Terrain.DistanceToWater(gameObject) < 2f) { if (level < 3) { lifeLevelToAdd += 2; } } // Energy from terrain type if (terrainTile.GetComponent <S_TerrainTile>().GetTileType() == S_Terrain.TERRAIN_TYPES["grassland"]) { if (level == 1) { lifeLevelToAdd += 2; } } if (terrainTile.GetComponent <S_TerrainTile>().GetTileType() == S_Terrain.TERRAIN_TYPES["plains"]) { if (level == 1) { lifeLevelToAdd += 1; } } if (terrainTile.GetComponent <S_TerrainTile>().GetTileType() == S_Terrain.TERRAIN_TYPES["desert"]) { if (GetObjectType() == TREE_TYPE["cactus"]) { if (level == 1) { lifeLevelToAdd += 2; } } else { lifeLevelToAdd -= 1; } } // Flower if (objectType == TREE_TYPE["cactus"]) { if (level == 3) { if (Random.value < 0.05) { CreateFlower(); } } } AddLifeEnergy(lifeLevelToAdd); } }
public void CalculateHumidity() { // Distance to water float distanceToWater = S_Terrain.DistanceToWater(gameObject); humidity = (10.0f / Mathf.Exp(distanceToWater)) * (1.0f - (temperature / 350f)); humidity += Humidity_Temperature.Evaluate((temperature - Config.Temperature_Min) / (Config.Temperature_Max - Config.Temperature_Min)) * 10.0f; //if (temperature > 10.0f && temperature < 25.0f) // humidity += 10.0f; }