public static void SetRelationship(int a, int b, Diplo relationship) { if (a > MaxFactions - 1 || a < 0 || b < 0 || b > MaxFactions - 1) { Debug.Log("Invalid faction ids were entered, no action taken"); } else { RelationshipMatrix [a, b] = relationship; RelationshipMatrix [b, a] = relationship; } }
public static Diplo GetRelationship(int a, int b) { Diplo e; if (a > MaxFactions - 1 || a < 0 || b < 0 || b > MaxFactions - 1) { Debug.Log("Invalid faction ids were entered, result will be incorrect"); e = Diplo.WAR; } else { Diplo d = RelationshipMatrix[a, b]; Diplo r = RelationshipMatrix[b, a]; e = d; if (d != r) { Debug.Log("The relationships are different, something went wrong, result will be incorrect"); } } return(e); }
public static bool IsHostile(FAC s, FAC o) { int self = (int)s; int other = (int)o; Diplo e; if (self > MaxFactions - 1 || self < 0 || other < 0 || other > MaxFactions - 1) { Debug.Log("Invalid faction ids were entered, result will be incorrect"); e = Diplo.WAR; } else { Diplo d = RelationshipMatrix[self, other]; Diplo r = RelationshipMatrix[other, self]; e = d; if (d != r) { Debug.Log("The relationships are different, something went wrong, result will be incorrect"); } } return(e == Diplo.WAR); }