예제 #1
0
        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);
        }
예제 #2
0
        private bool HasConstructionSkill(ProtoCrewMember crew)
        {
            ExperienceEffect skill = crew.experienceTrait.Effects.Where(e => e is ExConstructionSkill).FirstOrDefault();

            if (skill == null)
            {
                return(false);
            }
            return(true);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
            /// <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);
            }