public static void LoadAll(IEnumerable <ContentFile> files) { CPRSettings.Unload(); InternalDamage = null; ImpactDamage = null; Bleeding = null; Burn = null; OxygenLow = null; Bloodloss = null; Pressure = null; Stun = null; #if CLIENT CharacterHealth.DamageOverlay?.Remove(); CharacterHealth.DamageOverlay = null; CharacterHealth.DamageOverlayFile = string.Empty; #endif var prevPrefabs = Prefabs.AllPrefabs.SelectMany(kvp => kvp.Value).ToList(); foreach (var prefab in prevPrefabs) { prefab?.Dispose(); } System.Diagnostics.Debug.Assert(Prefabs.Count() == 0, "All previous AfflictionPrefabs were not removed in AfflictionPrefab.LoadAll"); foreach (ContentFile file in files) { LoadFromFile(file); } if (InternalDamage == null) { DebugConsole.ThrowError("Affliction \"Internal Damage\" not defined in the affliction prefabs."); } if (Bleeding == null) { DebugConsole.ThrowError("Affliction \"Bleeding\" not defined in the affliction prefabs."); } if (Burn == null) { DebugConsole.ThrowError("Affliction \"Burn\" not defined in the affliction prefabs."); } if (OxygenLow == null) { DebugConsole.ThrowError("Affliction \"OxygenLow\" not defined in the affliction prefabs."); } if (Bloodloss == null) { DebugConsole.ThrowError("Affliction \"Bloodloss\" not defined in the affliction prefabs."); } if (Pressure == null) { DebugConsole.ThrowError("Affliction \"Pressure\" not defined in the affliction prefabs."); } if (Stun == null) { DebugConsole.ThrowError("Affliction \"Stun\" not defined in the affliction prefabs."); } }
public static void RemoveByFile(string filePath) { if (CPRSettings.FilePath == filePath) { CPRSettings.Unload(); } #if CLIENT if (CharacterHealth.DamageOverlayFile == filePath) { CharacterHealth.DamageOverlay?.Remove(); CharacterHealth.DamageOverlay = null; } #endif Prefabs.RemoveByFile(filePath); }