public void UnregisterExtension(IWeaponExtension extension) { if (_extensions.ContainsValue(extension)) { _extensions.Remove(_extensions.First(x => x.Value == extension).Key); } else { throw new ArgumentException($"Extension {extension.GetType().FullName} not yet registered"); } }
public void RegisterExtension(IWeaponExtension extension) { string extensionName = extension.GetType().FullName; if (!_extensions.ContainsKey(extensionName)) { _extensions.Add(extensionName, extension); } else { throw new ArgumentException($"Extension: {extensionName} already registered"); } }
public bool HasExtension(IWeaponExtension extension) { return(_extensions.ContainsValue(extension)); }