static TraitData() { // add Traits, take functions of static class IntensityFunctionCollection to assign Trait IntensityFunction delegates // Determines Maximum Size of a Character (e.g. Creature or Plant) available_traits[(int)TraitTypes.MaxSize] = new Trait(TraitTypes.MaxSize, 8, IntensityFunctionCollection.CountTrueValues); // Determines rate of growth available_traits[(int)TraitTypes.GrowRate] = new Trait(TraitTypes.GrowRate, 10, IntensityFunctionCollection.CountTrueValues); // Determines how much leaves are produced (+ how much light can be consumed and blocked). available_traits[(int)TraitTypes.LeavesDensity] = new Trait(TraitTypes.LeavesDensity, 7, IntensityFunctionCollection.CountTrueValues); // Determines how much light is needed to stay alive and grow (overlaps heavily with growing-related Traits, genome-wise.) available_traits[(int)TraitTypes.LightRequirement] = new Trait(TraitTypes.LightRequirement, 16, IntensityFunctionCollection.CountFalseValues); // Basic value for determination of kids or saplings count available_traits[(int)TraitTypes.OffspringCount] = new Trait(TraitTypes.OffspringCount, 10, IntensityFunctionCollection.CountTrueValues); // check that every entry of enum has been set for (int i = 0; i < TraitTypes.GetNames(typeof(TraitTypes)).Length; i++) { if (available_traits[i] == null) { Debug.LogError("The Trait " + ((TraitTypes)i).ToString() + " at position available_traits[" + i + "] has not been set correctly."); } } // check that enum and array match each other for (int i = 0; i < TraitTypes.GetNames(typeof(TraitTypes)).Length; i++) { if (available_traits[i].Name != ((TraitTypes)i).ToString()) // can be simplifyed to comparison of TraitTypes { Debug.LogError("Initialization of Traits failed. available_traits[" + i + "].Name = " + available_traits[i].Name + ", when it should be " + ((TraitTypes)i).ToString()); } } }
public Page( int _numPageInFile, TraitTypes _pageTraitType, Guid _baseGuid, Guid _pageGuid) { numPageInFile = _numPageInFile; _data.type = (ushort)_pageTraitType; _data.pageGUID = _pageGuid; _data.baseGUID = _baseGuid; }
public Trait GetZeroTrait(TraitTypes _type) { return(_storage[(int)_type].GetZeroTrait()); }
public static Trait getTrait(TraitTypes trait_type) { return(available_traits[(int)trait_type]); }
internal TraitData(TraitTypes _traitType, EntityId _entityId, LatticeId _latticeId) : base(_traitType, _entityId, _latticeId) { }
internal Page CreateNewPage(TraitTypes _traitType) { Page page = new Page(pages.Count, _traitType, baseGuid, Guid.NewGuid()); return(page); }
/// <summary> /// Generates a string listing of the specified trait type, visible only, by name and cost only. 0 cost traits do not have a cost listed. /// </summary> /// <param name="traitType">Type of trait to harvest.</param> /// <returns>A comma separated, period-terminated list.</returns> string SimpleStringTrait(TraitTypes traitType) { var result = from trait in Traits where trait.ItemType == traitType where string.IsNullOrEmpty(trait.get_TagItem("hide")) select trait.Points != 0 ? String.Format("{0} [{1}]", trait.Name, trait.Points) : trait.Name; return String.Join(", ", result) + "."; }
/// <summary> /// Generates a SJG-formatted list of the specified trait type, visible traits only. /// This includes "effective skill", name extensions, but not modifiers or "level" in the advantage sense. /// </summary> /// <param name="traitType">Type of trait to harvest.</param> /// <returns>A comma separated, period-terminated list.</returns> string ComplexStringSkillsSpells(TraitTypes traitType) { var result = from trait in Traits where trait.ItemType == traitType where string.IsNullOrEmpty(trait.get_TagItem("hide")) select trait; return String.Join(", ", result) + "."; }
/// <summary> /// Generates a SJG-formatted list of the specified trait type, visible traits only. /// This includes level, name extensions, and modifiers, but not "effective skill". /// </summary> /// <param name="traitType">Type of trait to harvest.</param> /// <returns>A semicolon separated, period-terminated list.</returns> string ComplexStringAdsDisads(TraitTypes traitType, GCAWriter fw) { var result = from trait in Traits where trait.ItemType == traitType where string.IsNullOrEmpty(trait.get_TagItem("hide")) select trait; return String.Join("; ", result.Select(x => AdvantageFormatter(x, fw))) + "."; }
IEnumerable<string> ComplexListTrait(TraitTypes traitType, GCAWriter fw) { var result = from trait in Traits where trait.ItemType == traitType where string.IsNullOrEmpty(trait.get_TagItem("hide")) select FormatTrait(trait, fw); return result; }