Пример #1
0
        /// <summary>
        ///     Recursively resolves the entire decision tree. (The lazy non stack friendly way, the trees are not supposed to get
        ///     giant anyway.)
        /// </summary>
        /// <param name="def">Def to set.</param>
        public void Resolve(AbilityUserAIProfileDef def)
        {
            profileDef = def;

            //Debug
            //Log.Message("Resolving for '" + GetType().ToString() + "' for def '" + def.defName + "'");

            foreach (var node in subNodes)
            {
                node.parent = this;
                node.Resolve(def);
            }
        }
Пример #2
0
 /// <summary>
 ///     First check on whether a Ability can be used or not. Default implementation have no special criterias.
 /// </summary>
 /// <param name="profileDef">Profile Def to check for.</param>
 /// <param name="pawn">Pawn to check for.</param>
 /// <param name="abilityDef">Ability Def to check for.</param>
 /// <returns>True if Ability can be used. False if not.</returns>
 public virtual bool CanUseAbility(AbilityUserAIProfileDef profileDef, Pawn pawn, AbilityAIDef abilityDef)
 {
     return(true);
 }
Пример #3
0
 /// <summary>
 ///     Checks whether this Profile is valid for the Pawn or not. Returns true if it eligible for use. Default
 ///     implementation only cares about checking for matching Traits.
 /// </summary>
 /// <param name="profileDef">Profile Def to check for.</param>
 /// <param name="pawn">Pawn to check for.</param>
 /// <returns>True if its eligible. False if not.</returns>
 public virtual bool ValidProfileFor(AbilityUserAIProfileDef profileDef, Pawn pawn)
 {
     //Default implementation only cares about checking for matching Traits.
     return(profileDef.matchingTraits.Count <= 0 || profileDef.matchingTraits.Count > 0 &&
            profileDef.matchingTraits.Any(traitDef => pawn.story.traits.HasTrait(traitDef)));
 }