Пример #1
0
 public Attributes(string name, EyeColour eyes, HairColour hair, int age)
 {
     Name = name;
     Eyes = eyes;
     Hair = hair;
     Age  = age;
 }
 public HumanGenetics(GameObject go, Human human)
 {
     _go         = go;
     _human      = human;
     _eyeColour  = (EyeColour)Random.Range(0, 10);
     _hairColour = (HairColour)Random.Range(0, 17);
     _skinTone   = (SkinTone)Random.Range(0, 24);
     ChooseClothes();
 }
Пример #3
0
 public Character(string n, Gender g, HairColour hc, HairStyle hs, EyesColour ec, SkinColour sc, List <OthersAttributes> o)
 {
     Name       = n;
     Gender     = g;
     HairColour = hc;
     HairStyle  = hs;
     EyesColour = ec;
     SkinColour = sc;
     Others     = o;
 }
    public HumanGenetics(GameObject go, Human human, Human father, Human mother)
    {
        _go    = go;
        _human = human;
        HumanGenetics temp = BreedHumanGenetics(father._humanGenetics, mother._humanGenetics);

        _eyeColour  = temp._eyeColour;
        _hairColour = temp._hairColour;
        _skinTone   = temp._skinTone;
        ChooseClothes();
    }
Пример #5
0
 private bool ValidateField(KeyValuePair <string, string> kvp)
 {
     var(key, value) = kvp;
     return(key switch
     {
         "byr" => BirthYear.IsValid(value),
         "iyr" => IssueYear.IsValid(value),
         "eyr" => ExpirationYear.IsValid(value),
         "hgt" => Height.IsValid(value),
         "hcl" => HairColour.IsValid(value),
         "ecl" => EyeColour.IsValid(value),
         "pid" => PassportId.IsValid(value),
         "cid" => true,
         _ => false
     });
 HairColour SimplifyColour(HairColour h)
 {
     if ((int)h < 6)
     {
         return(HairColour.LightAshBlonde);
     }
     else if ((int)h < 12)
     {
         return(HairColour.LightestGoldenBrown);
     }
     else if ((int)h < 16)
     {
         return(HairColour.StrawberryBlonde);
     }
     else
     {
         return(HairColour.Silver);
     }
 }
    public HumanGenetics(GameObject go, Human human, int template)
    {
        _go         = go;
        _human      = human;
        _eyeColour  = (EyeColour)Random.Range(0, 10);
        _hairColour = (HairColour)Random.Range(0, 17);
        ChooseClothes();
        switch (template)
        {
        case 0:
        {
            _skinTone = SkinTone.light4;
            break;
        }

        case 1:
        {
            _skinTone = SkinTone.light0;
            break;
        }

        case 2:
        {
            _skinTone = SkinTone.light2;
            break;
        }

        case 3:
        {
            _skinTone = SkinTone.dark0;
            break;
        }

        case 4:
        {
            _skinTone = SkinTone.medium0;
            break;
        }
        }
    }
 HairColour DesimplifyColour(HairColour h)
 {
     if (h == HairColour.LightAshBlonde)
     {
         int temp = Random.Range(0, 6);
         return((HairColour)temp);
     }
     else if (h == HairColour.LightestGoldenBrown)
     {
         int temp = Random.Range(0, 6) + 6;
         return((HairColour)temp);
     }
     else if (h == HairColour.StrawberryBlonde)
     {
         int temp = Random.Range(0, 4) + 12;
         return((HairColour)temp);
     }
     else
     {
         return(h);
     }
 }
    HairColour BreedHairColour(HairColour father, HairColour mother)
    {
        father = SimplifyColour(father);
        mother = SimplifyColour(mother);
        int temp = Random.Range(0, 100);

        if (father == mother)
        {
            if (father == HairColour.LightAshBlonde) //blonde-blonde
            {
                if (temp < 75)                       //75% chance for blonde
                {
                    return(DesimplifyColour(father));
                }
                else if (temp < 75 + 10)   //10% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
                else if (temp < 75 + 10 + 10)   //10% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else   //5% chance for silver
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
            }
            else if (father == HairColour.LightestGoldenBrown) //brown-brown
            {
                if (temp < 75)                                 //75% chance for brown
                {
                    return(DesimplifyColour(father));
                }
                else if (temp < 75 + 10)   //10% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
                else if (temp < 75 + 10 + 10)   //10% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else   //5% chance for silver
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
            }
            else if (father == HairColour.StrawberryBlonde) //ginger-ginger
            {
                if (temp < 75)                              //75% chance for ginger
                {
                    return(DesimplifyColour(father));
                }
                else if (temp < 75 + 10)   //10% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
                else if (temp < 75 + 10 + 10)   //10% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
                else   //5% chance for silver
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
            }
            else if (father == HairColour.Silver)
            {
                return(DesimplifyColour(father));
            }
        }
        else if (father == HairColour.LightAshBlonde || mother == HairColour.LightAshBlonde)          //blonde-?
        {
            if (father == HairColour.LightestGoldenBrown || mother == HairColour.LightestGoldenBrown) //blonde-brown
            {
                if (temp < 50)                                                                        //50% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
                else if (temp < 50 + 30)   //30% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
                else if (temp < 50 + 30 + 15)   //15% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
            }
            else if (father == HairColour.StrawberryBlonde || mother == HairColour.StrawberryBlonde) //blonde-ginger
            {
                if (temp < 50)                                                                       //50% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
                else if (temp < 50 + 35)   //35% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else if (temp < 50 + 35 + 10)   //10% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
                else
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
            }
            else               //blonde-silver
            {
                if (temp < 50) //50% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
                else if (temp < 50 + 40)   //40% chance for silver
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
                else if (temp < 50 + 45)   //5% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else   //5% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
            }
        }
        else if (father == HairColour.LightestGoldenBrown || mother == HairColour.LightestGoldenBrown) //brown-?
        {
            if (father == HairColour.StrawberryBlonde || mother == HairColour.StrawberryBlonde)        //brown-ginger
            {
                if (temp < 50)                                                                         //50% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else if (temp < 50 + 35)   //35% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
                else if (temp < 50 + 35 + 10)   //10% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
                else   //5% chance for silver
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
            }
            else               //brown-silver
            {
                if (temp < 50) //50% chance for silver
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
                else if (temp < 50 + 30)  //30% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
                else if (temp < 50 + 30 + 10)   //10% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else   //10% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
            }
        }
        else if (father == HairColour.StrawberryBlonde || mother == HairColour.StrawberryBlonde)   //ginger-silver
        {
            if (father == HairColour.Silver || mother == HairColour.Silver)
            {
                if (temp < 50) //50% chance for silver
                {
                    return(DesimplifyColour(HairColour.Silver));
                }
                else if (temp < 50 + 35)   //35% chance for ginger
                {
                    return(DesimplifyColour(HairColour.StrawberryBlonde));
                }
                else if (temp < 50 + 35 + 10)   //10% chance for brown
                {
                    return(DesimplifyColour(HairColour.LightestGoldenBrown));
                }
                else   //5% chance for blonde
                {
                    return(DesimplifyColour(HairColour.LightAshBlonde));
                }
            }
        }
        return(DesimplifyColour(HairColour.LightAshBlonde)); //default
    }