/// <summary> /// Returns the Value For the Setting, when the type is Active/Dead (If not found, it will automatically Search in Global) /// </summary> /// <param name="settingName">The Name of the setting to return.</param> /// <param name="OpponentIsDead">Specify which setting to return, (Active or Dead)</param> /// <returns>Returns the Instance Value of the Proper Setting (Active/Dead or Global)</returns> internal int GetSetting(string settingName, bool OpponentIsDead) { AlgorithmSetting foundSetting = null; if (GlobalSettings.Any(v => v.Name == settingName)) { //Setting was not found in Active/Dead - try in Global... foundSetting = GlobalSettings.FirstOrDefault(v => v.Name == settingName); } else { //Get the Value from the Proper Collection. if (OpponentIsDead) { foundSetting = DeadSettings.FirstOrDefault(v => v.Name == settingName); } else { foundSetting = ActiveSettings.FirstOrDefault(v => v.Name == settingName); } } if (foundSetting == null) { Log.Error($"[Custom Algorithm Settings]{settingName} Setting Does not exist! - Developer! - Check Algorithm Configuration!"); return(-1); } return(foundSetting.Value); }