示例#1
0
 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"));
     }
 }
示例#2
0
 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"));
     }
 }
示例#3
0
 public bool IsFriendly(BDTeam other)
 {
     if (other == null)
     {
         return(false);
     }
     return(!IsEnemy(other));
 }
示例#4
0
 public bool IsEnemy(BDTeam other)
 {
     if (Neutral || other == null || other.Neutral || other.Name == Name || Allies.Contains(other.Name))
     {
         return(false);
     }
     return(true);
 }
示例#5
0
 public bool Equals(BDTeam other) => Name == other?.Name;