protected DestroyableObject(string name, int startHealth = 1) : base(name) { Id = Guid.NewGuid().ToString(); BaseProtection = new Dictionary <Element, int>(); StatusesImmunity = new List <string>(); Statuses = new ObjectStatusesCollection(Id, status => StatusesImmunity.Contains(status)); health = startHealth; ObjectEffects = new List <IObjectEffect>(); }
protected DestroyableObject(SaveData data) : base(data) { Id = data.GetStringValue(SaveKeyId); BaseProtection = data.GetObject <DictionarySaveable>(SaveKeyBaseProtection).Data .ToDictionary(pair => (Element)int.Parse((string)pair.Key), pair => int.Parse((string)pair.Value)); StatusesImmunity = data.GetValuesCollection(SaveKeyStatusesImmunity).ToList(); var statusesData = data.Objects[SaveKeyStatuses]; Statuses = new ObjectStatusesCollection(statusesData, status => StatusesImmunity.Contains(status)); health = data.GetIntValue(SaveKeyHealth); ObjectEffects = new List <IObjectEffect>(); }