CaveworldFlora.ClusterPlant.Destroy C# (CSharp) Method

Destroy() public method

Destroy the plant and the associated glower if existing.
public Destroy ( DestroyMode mode = DestroyMode.Vanish ) : void
mode DestroyMode
return void
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);
            TryToDestroyGlower();
            if (cluster.DestroyedOrNull() == false)
            {
                cluster.NotifyPlantRemoved();
            }
        }

Usage Example

Beispiel #1
0
 public static ClusterPlant TryToSpawnNewSymbiosisCluster(Cluster cluster)
 {
     // Check there is not already a symbiosis cluster.
     if (cluster.symbiosisCluster == null)
     {
         foreach (IntVec3 cell in GenRadial.RadialCellsAround(cluster.Position, cluster.plantDef.clusterSpawnRadius, false).InRandomOrder())
         {
             if (cell.InBounds() == false)
             {
                 continue;
             }
             ClusterPlant plant = cell.GetFirstThing(cluster.plantDef) as ClusterPlant;
             if (plant != null)
             {
                 plant.Destroy();
                 ClusterPlant symbiosisPlant = Cluster.SpawnNewClusterAt(cell, cluster.plantDef.symbiosisPlantDefEvolution, cluster.plantDef.symbiosisPlantDefEvolution.clusterSizeRange.RandomInRange);
                 cluster.NotifySymbiosisClusterAdded(symbiosisPlant.cluster);
                 return(symbiosisPlant);
             }
         }
     }
     return(null);
 }