public static BDTeam Deserialize(string teamString) { // Backward compatibility if (string.IsNullOrEmpty(teamString) || teamString == "False") { return(BDTeam.Get("A")); } else if (teamString == "True") { return(BDTeam.Get("B")); } try { BDTeam team = UnityEngine.JsonUtility.FromJson <BDTeam>(Misc.JsonDecompat(teamString)); if (!BDArmorySetup.Instance.Teams.ContainsKey(team.Name)) { BDArmorySetup.Instance.Teams.Add(team.Name, team); } return(BDArmorySetup.Instance.Teams[team.Name]); } catch { return(BDTeam.Get("A")); } }
public static BDTeam Deserialize(string teamString) { // Backward compatibility if (string.IsNullOrEmpty(teamString) || teamString == "False") { return(BDTeam.Get("A")); } else if (teamString == "True") { return(BDTeam.Get("B")); } try { BDTeam team = UnityEngine.JsonUtility.FromJson <BDTeam>(Misc.JsonDecompat(teamString)); if (!BDArmorySetup.Instance.Teams.ContainsKey(team.Name)) { BDArmorySetup.Instance.Teams.Add(team.Name, team); } return(BDArmorySetup.Instance.Teams[team.Name]); } catch (Exception e) { Debug.LogWarning("[BDArmory.BDTeam]: Exception thrown in Deserialize: " + e.Message + "\n" + e.StackTrace); return(BDTeam.Get("A")); } }
public bool IsFriendly(BDTeam other) { if (other == null) { return(false); } return(!IsEnemy(other)); }
public bool IsEnemy(BDTeam other) { if (Neutral || other == null || other.Neutral || other.Name == Name || Allies.Contains(other.Name)) { return(false); } return(true); }
public bool Equals(BDTeam other) => Name == other?.Name;