CaveworldFlora.ClusterPlant.IsLightConditionOkAt C# (CSharp) Method

IsLightConditionOkAt() public static method

public static IsLightConditionOkAt ( ThingDef_ClusterPlant plantDef, IntVec3 position ) : bool
plantDef ThingDef_ClusterPlant
position IntVec3
return bool
        public static bool IsLightConditionOkAt(ThingDef_ClusterPlant plantDef, IntVec3 position)
        {
            float light = Find.GlowGrid.GameGlowAt(position);
            if ((light >= plantDef.minLight)
                && (light <= plantDef.maxLight))
            {
                return true;
            }
            return false;
        }

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::IsLightConditionOkAt