Example #1
0
 /// <summary>
 /// Adds a bidrectional relationship between two teams. Both teams must have been added already to the builder.
 /// </summary>
 /// <param name="teamA">One of the teams to set the relationship for.</param>
 /// <param name="teamB">The other team to set the relationship for.</param>
 /// <param name="relationship">The relationship the teams have.</param>
 /// <returns>The arena builder for chaining.</returns>
 public ArenaBuilder <T> AddBidirectionalTeamRelationship(T teamA, T teamB, TeamRelationship relationship)
 {
     if (!teams.Contains(teamA))
     {
         throw new InvalidOperationException($"{teamA} has not been added to this arena.");
     }
     if (!teams.Contains(teamB))
     {
         throw new InvalidOperationException($"{teamB} has not been added to this arena.");
     }
     allianceGraph.AddBidirectionalRelation(teamA, teamB, relationship);
     return(this);
 }
Example #2
0
 /// <summary>
 /// Gets the teams that receive the specified relationship from the given team.
 /// </summary>
 /// <param name="from">The team from which the relationship originates.</param>
 /// <param name="relationship">The relationship the team creates.</param>
 /// <returns>All the teams with the specified relationship.</returns>
 public IList <ITeam> GetTeamsWithRelationship(ITeam from, TeamRelationship relationship)
 {
     return(AllianceGraph.GetTeamsWithRelationship(from, relationship));
 }
Example #3
0
 /// <summary>
 /// Gets the teams that the given team has the specified relationship towards.
 /// </summary>
 /// <param name="from">The team that has the relationship.</param>
 /// <param name="relationship">The relationship that the team has for the others.</param>
 /// <typeparam name="T">The type of team to get.</typeparam>
 /// <returns>An enumerable with the teams that the given team has the relationship with.</returns>
 public IList <T> GetTeamsWithRelationship <T>(T from, TeamRelationship relationship) where T : ITeam
 {
     return(GetTeamsWithRelationship(from, relationship).Cast <T>().ToList());
 }