/// <summary> /// Add a new trait to the race's collection of traits. /// </summary> /// <param name="newTrait">The code or short name of a trait such as IS for Improved Starbases. These are defined in AllTraits.</param> public void Add(string newTrait) { foreach (DictionaryEntry de in AllTraits.Data.Secondary) { TraitEntry trait = de.Value as TraitEntry; if (trait.Code == newTrait) { Dictionary.Add(trait.Code, trait); } } }
/// <summary> /// Control access to the primary trait. It can be read as a public property. /// It can be set using the SetPrimary() accessor function passing either a /// TraitEntry or a String containing one of the primary trait codes. /// </summary> /// <param name="primaryTrait">The new primary trait.</param> public void SetPrimary(string primaryTrait) { foreach (DictionaryEntry de in AllTraits.Data.Primary) { TraitEntry trait = de.Value as TraitEntry; if (trait.Code == primaryTrait || trait.Name == primaryTrait) { this.primaryTrait = trait; return; } } Report.Error("The primaryTrait \"" + primaryTrait + "\" is not recognised. Failed to set primary trait."); }
/// <summary> /// Remove a trait from the race's collection of traits. /// </summary> /// <param name="traitToRemove">The trait to remove.</param> public void Remove(TraitEntry traitToRemove) { Dictionary.Remove(traitToRemove.Code); }
/// <summary> /// Add a new trait to the race's collection of traits. /// </summary> /// <param name="new_trait">A TraitEntry, such as those in SecondaryTraits.</param> public void Add(TraitEntry new_trait) { Dictionary.Add(new_trait.Code, new_trait); }
/// <summary> /// Control access to the primary trait. It can be read as a public property. /// It can be set using the SetPrimary() accessor function passing either a /// TraitEntry or a String containing one of the primary trait codes. /// </summary> /// <param name="primaryTrait">The new primary trait.</param> public void SetPrimary(TraitEntry primaryTrait) { this.primaryTrait = primaryTrait; }