Ejemplo n.º 1
0
 override public void SetBasement(SurfaceBlock b, PixelPosByte pos)
 {
     if (b == null)
     {
         return;
     }
     //#setStructureData
     basement      = b;
     innerPosition = new SurfaceRect(pos.x, pos.y, innerPosition.size);
     if (model == null)
     {
         SetModel();
     }
     b.AddStructure(this);
     // isbasement check deleted
     //---
     if (!addedToClassList)
     {
         corns.Add(this);
         addedToClassList = true;
         if (((existingPlantsMask >> CROP_CORN_ID) & 1) != 1)
         {
             int val = 1;
             val = val << CROP_CORN_ID;
             existingPlantsMask += val;
         }
     }
 }
Ejemplo n.º 2
0
    protected void PrepareMultiblockStructure(SurfaceBlock b, PixelPosByte pos)
    {
        basement      = b;
        innerPosition = new SurfaceRect(pos.x, pos.y, innerPosition.x_size, innerPosition.z_size);
        b.AddStructure(this);
        Chunk myChunk = basement.myChunk;

        for (byte i = 1; i < additionalHeight; i++)
        {
            myChunk.BlockByStructure(b.pos.x, (byte)(b.pos.y + i), b.pos.z, this);
        }
    }
Ejemplo n.º 3
0
 override public void SetBasement(SurfaceBlock b, PixelPosByte pos)
 {
     if (b == null)
     {
         return;
     }
     basement      = b;
     innerPosition = new SurfaceRect(pos.x, pos.y, xsize_to_set, zsize_to_set);
     b.AddStructure(new SurfaceObject(innerPosition, this));
     myChunk = basement.myChunk;
     for (byte i = 1; i < height; i++)
     {
         myChunk.BlockByStructure(b.pos.x, (byte)(b.pos.y + i), b.pos.z, this);
     }
     myChunk.AddLifePower(GameMaster.START_LIFEPOWER);
 }
Ejemplo n.º 4
0
 // в финальном виде копипастить в потомков
 protected void SetStructureData(SurfaceBlock b, PixelPosByte pos)
 {
     //#setStructureData
     basement      = b;
     innerPosition = new SurfaceRect(pos.x, pos.y, innerPosition.size);
     if (transform.childCount == 0)
     {
         SetModel();
     }
     b.AddStructure(this);
     if (isBasement)
     {
         if (!subscribedToChunkUpdate)
         {
             basement.myChunk.ChunkUpdateEvent += ChunkUpdated;
             subscribedToChunkUpdate            = true;
         }
         if (basement is CaveBlock)
         {
             basement.myChunk.ReplaceBlock(basement.pos, BlockType.Surface, basement.material_id, false);
         }
         if (basement.pos.y + 1 < Chunk.CHUNK_SIZE)
         {
             ChunkPos npos       = new ChunkPos(basement.pos.x, basement.pos.y + 1, basement.pos.z);
             Block    upperBlock = basement.myChunk.GetBlock(npos.x, npos.y, npos.z);
             if (upperBlock == null)
             {
                 basement.myChunk.AddBlock(npos, BlockType.Surface, ResourceType.CONCRETE_ID, false);
             }
         }
         else
         {
             GameObject g = PoolMaster.GetRooftop(this);
             g.transform.parent        = basement.transform;
             g.transform.localPosition = Vector3.up * Block.QUAD_SIZE / 2f;
             g.name = "block ceiling";
         }
     }
 }