private FrostbiteSaveDataProxy ConvertBackFrostBite(FrostbiteSaveDataProxy proxy, Dictionary <AfflictionType, List <Affliction> > afflictionDict) { proxy = proxy ?? new FrostbiteSaveDataProxy(); var frostbites = afflictionDict.GetOrDefault(AfflictionType.Frostbite, new List <Affliction>()).Cast <Frostbite>().ToList(); var frostbiteRisks = afflictionDict.GetOrDefault(AfflictionType.FrostbiteRisk, new List <Affliction>()).Cast <Frostbite>().ToList(); var frostbiteDamage = afflictionDict.GetOrDefault(AfflictionType.FrostbiteDamage, new List <Affliction>()).Cast <Frostbite>().ToList(); proxy.m_LocationsCurrentFrostbiteDamage = new List <float>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; proxy.m_LocationsWithActiveFrostbite = new List <int>(); foreach (var frostbite in frostbites) { proxy.m_LocationsWithActiveFrostbite.Add(frostbite.Location); proxy.m_LocationsCurrentFrostbiteDamage[frostbite.Location] = frostbite.Damage; } foreach (var frostbite in frostbiteRisks) { proxy.m_LocationsWithFrostbiteRisk.Add(frostbite.Location); proxy.m_LocationsCurrentFrostbiteDamage[frostbite.Location] = frostbite.Damage; } foreach (var frostbite in frostbiteDamage) { proxy.m_LocationsCurrentFrostbiteDamage[frostbite.Location] = frostbite.Damage; } return(proxy); }
private void ConvertFrostbite(FrostbiteSaveDataProxy proxy) { if (proxy == null) { return; } foreach (int bodyArea in proxy.m_LocationsWithActiveFrostbite) { Negative.Add(new Frostbite(negative) { AfflictionType = AfflictionType.Frostbite, Location = bodyArea, Damage = proxy.m_LocationsCurrentFrostbiteDamage[bodyArea], }); } foreach (int bodyArea in proxy.m_LocationsWithFrostbiteRisk) { Negative.Add(new Frostbite(negative) { AfflictionType = AfflictionType.FrostbiteRisk, Location = bodyArea, Damage = proxy.m_LocationsCurrentFrostbiteDamage[bodyArea], }); } }
private void ConvertFrostbite(FrostbiteSaveDataProxy proxy) { if (proxy == null) { return; } var frostbiteDamage = new List <float>(proxy.m_LocationsCurrentFrostbiteDamage); foreach (int bodyArea in proxy.m_LocationsWithActiveFrostbite) { Negative.Add(new Frostbite(negative) { AfflictionType = AfflictionType.Frostbite, Location = bodyArea, Damage = proxy.m_LocationsCurrentFrostbiteDamage[bodyArea], }); frostbiteDamage[bodyArea] = 0; } foreach (int bodyArea in proxy.m_LocationsWithFrostbiteRisk) { Negative.Add(new Frostbite(negative) { AfflictionType = AfflictionType.FrostbiteRisk, Location = bodyArea, Damage = proxy.m_LocationsCurrentFrostbiteDamage[bodyArea], }); frostbiteDamage[bodyArea] = 0; } for (int i = 0; i < frostbiteDamage.Count; i++) { if (frostbiteDamage[i] > 0) { Negative.Add(new Frostbite(negative) { AfflictionType = AfflictionType.FrostbiteDamage, Location = i, Damage = frostbiteDamage[i], }); } } }