/// <summary> /// Loads the given BodyPartPrototype - current data on this BodyPart will be overwritten! /// </summary> public virtual void LoadFromPrototype(BodyPartPrototype data) { Name = data.Name; Plural = data.Plural; PartType = data.PartType; RSIPath = data.RSIPath; RSIState = data.RSIState; MaxDurability = data.Durability; CurrentDamages = new BiologicalDamageContainer(); Resistance = data.Resistance; Size = data.Size; Compatibility = data.Compatibility; Properties = data.Properties; //_surgeryData = (ISurgeryData) Activator.CreateInstance(null, data.SurgeryDataName); //TODO: figure out a way to convert a string name in the YAML to the proper class (reflection won't work for reasons) _surgeryData = new BiologicalSurgeryData(this); IPrototypeManager prototypeManager = IoCManager.Resolve <IPrototypeManager>(); foreach (string mechanismPrototypeID in data.Mechanisms) { if (!prototypeManager.TryIndex(mechanismPrototypeID, out MechanismPrototype mechanismData)) { throw new InvalidOperationException("No MechanismPrototype was found with the name " + mechanismPrototypeID + " while loading a BodyPartPrototype!"); } _mechanisms.Add(new Mechanism(mechanismData)); } }
public BodyPart(BodyPartPrototype data) { SurgeryData = null !; Properties = new HashSet <IExposeData>(); Name = null !; Plural = null !; RSIPath = null !; RSIState = null !; RSIMap = null !; Damage = null !; Resistances = null !; LoadFromPrototype(data); }
public BodyPart(BodyPartPrototype data) { LoadFromPrototype(data); }