public static bool HasSkill <T> (ProtoCrewMember crew) where T : class { ExperienceEffect skill = crew.experienceTrait.Effects.Where(e => e is T).FirstOrDefault(); if (skill == null) { return(false); } return(true); }
private bool HasConstructionSkill(ProtoCrewMember crew) { ExperienceEffect skill = crew.experienceTrait.Effects.Where(e => e is ExConstructionSkill).FirstOrDefault(); if (skill == null) { return(false); } return(true); }
public virtual bool CanRunPart(string requiredTrait, int requiredLevel) { ExperienceEffect experienceEffect = this.protoCrewMember.GetEffect(requiredTrait); if (experienceEffect == null) { return(false); } else { return(experienceEffect.Level + this.protoCrewMember.experienceLevel >= requiredLevel); } }
/// <summary> /// Returns true if the specified crew member matches the trait we're looking for. /// </summary> /// <param name="crew"></param> /// <returns></returns> private bool Matches(ProtoCrewMember crew) { ExperienceTrait trait = crew.experienceTrait; if (trait == null) { return(false); } List <ExperienceEffect> effects = trait.Effects; if (effects == null) { return(false); } for (int i = 0; i < effects.Count; ++i) { ExperienceEffect effect = effects[i]; if (effectName == effect.Name) { return(trait.CrewMemberExperienceLevel() >= minLevel); } } return(false); }