Ejemplo n.º 1
0
        public ConfigNode Generate(ScenePhase phase, ConfigNode kerbalData)
        {
            ConfigNode perksNode = new ConfigNode(NodeName);

            float stupidity    = DangIt.Parse <float>(kerbalData.GetValue("stupidity"), 0.5f);
            float intelligence = 1 - stupidity;

            // Generate a random perk for each perk type
            foreach (Specialty spec in Enum.GetValues(typeof(Specialty)))
            {
                SkillLevel level = (SkillLevel)((int)Math.Floor(UnityEngine.Random.Range(0f, intelligence) / 0.25f));
                Perk       perk  = new Perk(spec, level);
                perksNode.AddNode(perk.ToNode());
            }

            return(perksNode);
        }
Ejemplo n.º 2
0
 public static bool MeetsRequirement(Perk requirement, List <Perk> perks)
 {
     return(perks.Any(p => MeetsRequirement(requirement, p)));
 }
Ejemplo n.º 3
0
 public static bool MeetsRequirement(Perk requirement, Perk perk)
 {
     return((requirement.Specialty == perk.Specialty) &&
            (perk.SkillLevel >= requirement.SkillLevel));
 }