示例#1
0
 public Human GenerateHuman(Human.SexType Sex)
 {
     if (Sex == Human.SexType.NoMatter)
     {
         Sex = Random.Range(0, 2) == 0 ? Human.SexType.Male : Human.SexType.Female;
     }
     return(new Human(FirstNames.GetItem(Sex) + ' ' + LastNames.GetItem(Sex), Sex, Faces.GetItem(Sex)));
 }
示例#2
0
    public string GetItem(Human.SexType Sex)
    {
        switch (Sex)
        {
        case Human.SexType.Male:
        {
            return(SortedItems[Random.Range(MaleIndexRange.start, MaleIndexRange.end)]);
        }

        case Human.SexType.Female:
        {
            return(SortedItems[Random.Range(FemaleIndexRange.start, FemaleIndexRange.end)]);
        }

        default:
        {
            return(SortedItems[Random.Range(0, SortedItems.Length)]);
        }
        }
    }
示例#3
0
    public Human GetNewHuman(Human.SexType Sex, Human.ProfessionType Profession, float SpecialChance)
    {
        if (Sex == Human.SexType.NoMatter)
        {
            Sex = Random.Range(0, 2) == 0 ? Human.SexType.Male : Human.SexType.Female;
        }
        HashSet <int> FreeSpecial;

        if (Sex == Human.SexType.Male)
        {
            FreeSpecial = FreePregeneratedMen;
        }
        else
        {
            FreeSpecial = FreePregeneratedWomen;
        }
        if (Random.value <= SpecialChance && FreeSpecial.Count > 0)
        {
            var Enum    = FreeSpecial.GetEnumerator();
            int elemPos = Random.Range(0, FreeSpecial.Count);
            for (int i = 0; i < elemPos; i++)
            {
                Enum.MoveNext();
            }
            FreeSpecial.Add(Enum.Current);
            if (Sex == Human.SexType.Male)
            {
                return(GameData.Data.HumanGenerator.PreGeneratedMen[Enum.Current]);
            }
            else
            {
                return(GameData.Data.HumanGenerator.PreGeneratedWomen[Enum.Current]);
            }
        }
        else
        {
            return(GameData.Data.HumanGenerator.GenerateHuman(Sex));
        }
    }