//Serialization stuff: public void WriteData(MyData.Writer writer) { writer.Int(NIterations, "nIterations"); writer.Float(TileVariation, "tileVariation"); KeyframeSerializer kfs = new KeyframeSerializer(); writer.Collection( TileChangeChances.keys, "tileChangeChances", (MyData.Writer w, Keyframe k, string name) => { kfs.Kf = k; w.Structure(kfs, name); }); }
public void ReadData(MyData.Reader reader) { NIterations = reader.Int("nIterations"); TileVariation = reader.Float("tileVariation"); KeyframeSerializer kfs = new KeyframeSerializer(); Keyframe[] keyframes = reader.Collection( "tileChangeChances", (MyData.Reader r, ref Keyframe outVal, string name) => { r.Structure(kfs, name); outVal = kfs.Kf; }, (size) => new Keyframe[size], (i, _kfs, kf) => _kfs[i] = kf); TileChangeChances.keys = keyframes; }