public void Randomize() { Gender = (Gender)UnityEngine.Random.Range(0, Enum.GetNames(typeof(Gender)).Length); SkinTone = (SkinTone)UnityEngine.Random.Range(0, Enum.GetNames(typeof(SkinTone)).Length - 1); HairType = UnityEngine.Random.Range(1, 16 + 1); HairColor = (HairColor)UnityEngine.Random.Range(0, Enum.GetNames(typeof(HairColor)).Length); }
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(); }
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(); }
SkinTone MiddleSkinTone(SkinTone father, SkinTone mother) { int temp = Random.Range(0, 100); if (temp < 60) { return((SkinTone)Mathf.Round(((int)father + (int)mother) / 2)); } else if (temp < 60 + 20) { return(father); } else { return(mother); } }
SkinTone SimplifyColour(SkinTone s) { if ((int)s < 6) { return(SkinTone.lightest0); } else if ((int)s < 12) { return(SkinTone.light0); } else if ((int)s < 18) { return(SkinTone.medium0); } else { return(SkinTone.dark0); } }
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; } } }
SkinTone BreedSkinTone(SkinTone father, SkinTone mother) { int temp = Random.Range(0, 100); if (SimplifyColour(father) == SimplifyColour(mother)) { if (temp < 50) { MiddleSkinTone(father, mother); } else if (temp < 50 + 25) { return(father); } else { return(mother); } } else { if (temp < 80) { MiddleSkinTone(father, mother); } else if (temp < 80 + 10) { return(father); } else { return(mother); } } return(MiddleSkinTone(father, mother)); }