Beispiel #1
0
        /// <summary>
        /// Generates a trait set for a Character, based on parent traits
        /// </summary>
        /// <returns>Array containing trait set</returns>
        /// <param name="mummyTraits">The mother's traits</param>
        /// <param name="daddyTraits">The father's traits</param>
        /// <param name="isMale">Whether character is a male</param>
        public static Tuple <Trait, int>[] GenerateTraitSetFromParents(Tuple <Trait, int>[] mummyTraits, Tuple <Trait, int>[] daddyTraits, bool isMale)
        {
            // store all unique traitKeys from both parents
            List <string> uniqueTraitKeys = new List <string>();

            // mummy's traits
            for (int i = 0; i < mummyTraits.Length; i++)
            {
                uniqueTraitKeys.Add(mummyTraits[i].Item1.id);
            }

            // daddy's traits
            for (int i = 0; i < daddyTraits.Length; i++)
            {
                if (!uniqueTraitKeys.Contains(daddyTraits[i].Item1.id))
                {
                    uniqueTraitKeys.Add(daddyTraits[i].Item1.id);
                }
            }

            // create new traits using uniqueTraitKeys
            Tuple <Trait, int>[] newTraits = Utility_Methods.GenerateTraitSet(uniqueTraitKeys);

            return(newTraits);
        }