예제 #1
0
 // ===================== Setup Work =====================
 /// <summary>
 /// Initialize instance variables.
 /// </summary>
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     // Set the default cluster radius. This should be overriden by the spawner.
     this.clusterSize = Rand.Range(this.def.plant.wildClusterSizeRange.min, this.def.plant.wildClusterSizeRange.max);
     if ((this.glowerBuilding.DestroyedOrNull()) &&
         (this.isInCryostasis == false))
     {
         this.glowerBuilding = GenSpawn.Spawn(Util_CavePlant.GetGlowerSmallDef(this.def), this.Position);
     }
 }
예제 #2
0
        /// <summary>
        /// Update the glower building according to the plant growth.
        /// </summary>
        public void UpdateGlowerBuildingAccordingToGrowth()
        {
            if (this.isInCryostasis)
            {
                TryToDestroyGlowerBulding();
                return;
            }

            if (this.Growth < 0.33f)
            {
                if ((this.glowerBuilding.DestroyedOrNull()) ||
                    (this.glowerBuilding.def != Util_CavePlant.GetGlowerSmallDef(this.def)))
                {
                    TryToDestroyGlowerBulding();
                    this.glowerBuilding = GenSpawn.Spawn(Util_CavePlant.GetGlowerSmallDef(this.def), this.Position);
                }
            }
            else if (this.Growth < 0.66f)
            {
                if ((this.glowerBuilding.DestroyedOrNull()) ||
                    (this.glowerBuilding.def != Util_CavePlant.GetGlowerMediumDef(this.def)))
                {
                    TryToDestroyGlowerBulding();
                    this.glowerBuilding = GenSpawn.Spawn(Util_CavePlant.GetGlowerMediumDef(this.def), this.Position);
                }
            }
            else
            {
                if ((this.glowerBuilding.DestroyedOrNull()) ||
                    (this.glowerBuilding.def != Util_CavePlant.GetGlowerBigDef(this.def)))
                {
                    TryToDestroyGlowerBulding();
                    this.glowerBuilding = GenSpawn.Spawn(Util_CavePlant.GetGlowerBigDef(this.def), this.Position);
                }
            }
        }