Esempio n. 1
0
 virtual public void Annihilate(PlaneAnnihilationOrder order)
 {
     if (!destroyed)
     {
         destroyed = true;
         if (extension != null)
         {
             extension.Annihilate(order);
         }
         else
         {
             if (mainStructure != null)
             {
                 if (!mainStructureIsABlocker)
                 {
                     mainStructure.Annihilate(order.GetStructuresOrder());
                 }
                 else
                 {
                     mainStructure.SectionDeleted(pos);
                 }
             }
         }
         if (!order.chunkClearing)
         {
             if (haveWorksite)
             {
                 GameMaster.realMaster.colonyController.RemoveWorksite(this);
                 haveWorksite = false;
             }
             if (faceIndex == Block.UP_FACE_INDEX | faceIndex == Block.SURFACE_FACE_INDEX)
             {
                 var b = host?.GetBlock();
                 if (b != null)
                 {
                     b.myChunk.needSurfacesUpdate = true;
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public void ClearSurface(PlaneAnnihilationOrder order)
 {
     if (structures == null)
     {
         myPlane.NullifyExtensionLink(this);
         return;
     }
     else
     {
         if (structures.Count > 0)
         {
             Structure se;
             StructureAnnihilationOrder strOrder = order.GetStructuresOrder();
             for (int i = 0; i < structures.Count; i++)
             {
                 se = structures[i];
                 if (se != null)
                 {
                     se.Annihilate(strOrder);
                 }
             }
             structures = null;
         }
         if (order.recalculateSurface)
         {
             RecalculateSurface();
         }
         else
         {
             if (order.deleteExtensionLink)
             {
                 myPlane.NullifyExtensionLink(this);
             }
         }
         grassland?.Annihilate(order.GetGrasslandOrder());
     }
 }