public void SetSelfAsParentTo(GenericFeature f) { f.parent = this; // if (f is FeaturePointer) { // FeaturePointer ptr = (FeaturePointer)f; // foreach (GenericFeature child in ptr.pool) { // SetSelfAsParentTo (child); // } // } }
public override SerializedObject GetInstance() { features = new List <GenericFeature> (); foreach (Wrapper f in featureWraps) { GenericFeature fe = (GenericFeature)f.GetInstance(); features.Add(fe); } //each feature needs to de serialize.... return(new ClassLevel5e(classType, level, features.ToList())); }
public static bool ShouldNotSerialize(GenericFeature f) { bool ret = false; foreach (System.Type t in nonSerializedTypes) { if (f.GetType() == t || f.GetType().IsSubclassOf(t)) { ret = true; break; } } return(ret); }
//SERIALIZATION public override Wrapper GetSerializableWrapper() { ClassLevel5eWrapper wrap = new ClassLevel5eWrapper(classType, level, features); List <GenericFeature> serialized = new List <GenericFeature> (); foreach (GenericFeature f in wrap.features) { if (GenericFeature.ShouldNotSerialize(f)) { continue; } serialized.Add(f); } wrap.featureWraps = serialized.Select((f) => f.GetSerializableWrapper()).ToArray(); return(wrap); }