Beispiel #1
0
    override public void Load(BlockSerializer bs)
    {
        LoadBlockData(bs);
        CaveBlockSerializer cbs = new CaveBlockSerializer();

        GameMaster.DeserializeByteArray <CaveBlockSerializer>(bs.specificData, ref cbs);
        LoadCaveBlockData(cbs);
    }
Beispiel #2
0
 protected void LoadCaveBlockData(CaveBlockSerializer cbs)
 {
     LoadSurfaceBlockData(cbs.surfaceBlockSerializer);
     ceilingRenderer.sharedMaterial = ResourceType.GetMaterialById(cbs.upMaterial_ID, ceilingRenderer.GetComponent <MeshFilter>(), illumination);
     haveSurface = cbs.haveSurface;
     if (!haveSurface)
     {
         surfaceRenderer.enabled = false;
         surfaceRenderer.GetComponent <Collider>().enabled = false;
     }
 }
Beispiel #3
0
    override public BlockSerializer Save()
    {
        BlockSerializer     bs  = GetBlockSerializer();
        CaveBlockSerializer cbs = new CaveBlockSerializer();

        cbs.upMaterial_ID          = material_id;
        cbs.haveSurface            = haveSurface;
        cbs.surfaceBlockSerializer = GetSurfaceBlockSerializer();
        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
        {
            new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(stream, cbs);
            bs.specificData = stream.ToArray();
        }
        return(bs);
    }