コード例 #1
0
ファイル: TraitList.cs プロジェクト: ekolis/stars-nova
 /// <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);
         }
     }
 }
コード例 #2
0
        /// <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.");
        }
コード例 #3
0
ファイル: TraitList.cs プロジェクト: ekolis/stars-nova
 /// <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);
 }
コード例 #4
0
ファイル: TraitList.cs プロジェクト: ekolis/stars-nova
 /// <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);
 }
コード例 #5
0
 /// <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;
 }