CaveworldFlora.ClusterPlant.IsTemperatureConditionOkAt C# (CSharp) Method

IsTemperatureConditionOkAt() public static method

public static IsTemperatureConditionOkAt ( ThingDef_ClusterPlant plantDef, IntVec3 position ) : bool
plantDef ThingDef_ClusterPlant
position IntVec3
return bool
        public static bool IsTemperatureConditionOkAt(ThingDef_ClusterPlant plantDef, IntVec3 position)
        {
            float temperature = position.GetTemperature();
            return ((temperature >= plantDef.minGrowTemperature)
                && (temperature <= plantDef.maxGrowTemperature));
        }

Usage Example

Beispiel #1
0
        public override void TickLong()
        {
            // Grow cluster and spawn symbiosis cluster.
            if ((Find.TickManager.TicksGame > this.nextGrownTick) &&
                ClusterPlant.IsTemperatureConditionOkAt(this.plantDef, this.Map, this.Position) &&
                ClusterPlant.IsLightConditionOkAt(this.plantDef, this.Map, this.Position))
            {
                this.nextGrownTick = Find.TickManager.TicksGame + (int)(this.plantDef.plant.reproduceMtbDays * GenDate.TicksPerDay);

                // Grow cluster.
                GenClusterPlantReproduction.TryGrowCluster(this);

                // Spawn symbiosis cluster.
                if ((this.actualSize == this.desiredSize) &&
                    (this.plantDef.symbiosisPlantDefEvolution != null))
                {
                    GenClusterPlantReproduction.TrySpawnNewSymbiosisCluster(this);
                }
            }

            // Spawn new cluster.
            if ((this.actualSize == this.desiredSize) &&
                (Find.TickManager.TicksGame > this.nextReproductionTick) &&
                ClusterPlant.IsTemperatureConditionOkAt(this.plantDef, this.Map, this.Position) &&
                ClusterPlant.IsLightConditionOkAt(this.plantDef, this.Map, this.Position))
            {
                GenClusterPlantReproduction.TrySpawnNewClusterAwayFrom(this);
                this.nextReproductionTick = Find.TickManager.TicksGame + (int)(this.plantDef.plant.reproduceMtbDays * 10f * GenDate.TicksPerDay);
            }
        }
All Usage Examples Of CaveworldFlora.ClusterPlant::IsTemperatureConditionOkAt