/// <summary> /// Returns all <see cref="Interaction"/>s the given character is involved in. /// </summary> /// <param name="character">The character.</param> /// <returns>A List of <see cref="Interaction"/> objects containing the character.</returns> public List<Interaction> GetInteractions(CharacterData character) { List<Interaction> interactions = new List<Interaction>(); interactions.AddRange(Interactions.Where(i => i.Involves(character))); return interactions; }
/// <summary> /// Returns all <see cref="Interaction"/>s between two characters. /// </summary> /// <param name="firstCharacter">The first character.</param> /// <param name="secondCharacter">The second character.</param> /// <returns>A List of <see cref="Interaction"/> objects containing both characters.</returns> public List<Interaction> GetInteractions(CharacterData firstCharacter, CharacterData secondCharacter) { List<Interaction> interactions = new List<Interaction>(); interactions.AddRange(Interactions.Where(i => i.IsBetween(firstCharacter, secondCharacter))); return interactions; }
/// <summary> /// Returns the interaction strenght between two characters. /// </summary> /// <param name="firstCharacter">The first character.</param> /// <param name="secondCharacter">The second character.</param> /// <returns>Sum of all interaction strenghts of the Interactions between the characters.</returns> public double GetInteractionStrenght(CharacterData firstCharacter, CharacterData secondCharacter) { // Sum up all interaction strength values return GetInteractions(firstCharacter, secondCharacter).Sum(x => x.InteractionStrength); }
public bool IsBetween(CharacterData firstCharacter, CharacterData secondCharacter) { return Equals(PrimaryCharacter, firstCharacter) && Equals(SecondaryCharacter, secondCharacter) || Equals(PrimaryCharacter, secondCharacter) && Equals(SecondaryCharacter, firstCharacter); }
public bool Involves(CharacterData character) { return Equals(character, PrimaryCharacter) || Equals(character, SecondaryCharacter); }
public bool IsBetween(CharacterData firstCharacter, CharacterData secondCharacter) { return(Equals(PrimaryCharacter, firstCharacter) && Equals(SecondaryCharacter, secondCharacter) || Equals(PrimaryCharacter, secondCharacter) && Equals(SecondaryCharacter, firstCharacter)); }
public bool Involves(CharacterData character) { return(Equals(character, PrimaryCharacter) || Equals(character, SecondaryCharacter)); }
/// <summary> /// Returns the interaction strenght between two characters. /// </summary> /// <param name="firstCharacter">The first character.</param> /// <param name="secondCharacter">The second character.</param> /// <returns>Sum of all interaction strenghts of the Interactions between the characters.</returns> public double GetInteractionStrenght(CharacterData firstCharacter, CharacterData secondCharacter) { // Sum up all interaction strength values return(GetInteractions(firstCharacter, secondCharacter).Sum(x => x.InteractionStrength)); }