示例#1
0
 /// <summary>
 /// Randomize character's body
 /// </summary>
 public void RandomizeBody()
 {
     character.SetBodyType(RollDice() > 50 ? BodyType.Male : BodyType.Female);
 }
示例#2
0
 public void RandomizePart()
 {
     // Get all available parts if null
     if (armors == null)
     {
         armors = PartList.Static.FindParts(SlotCategory.Armor);
     }
     if (pants == null)
     {
         pants = PartList.Static.FindParts(SlotCategory.Pants);
     }
     if (helmets == null)
     {
         helmets = PartList.Static.FindParts(SlotCategory.Helmet);
     }
     if (gloves == null)
     {
         gloves = PartList.Static.FindParts(SlotCategory.Gloves);
     }
     if (boots == null)
     {
         boots = PartList.Static.FindParts(SlotCategory.Boots);
     }
     if (capes == null)
     {
         capes = PartList.Static.FindParts(SlotCategory.Cape);
     }
     if (mainhand == null)
     {
         mainhand = PartList.Static.FindParts(SlotCategory.MainHand);
     }
     if (offhand == null)
     {
         offhand = PartList.Static.FindParts(SlotCategory.OffHand);
     }
     if (hair == null)
     {
         hair = PartList.Static.FindParts(SlotCategory.Hair);
     }
     if (fhair == null)
     {
         fhair = PartList.Static.FindParts(SlotCategory.FacialHair);
     }
     if (brow == null)
     {
         brow = PartList.Static.FindParts(SlotCategory.Eyebrow);
     }
     if (eyes == null)
     {
         eyes = PartList.Static.FindParts(SlotCategory.Eyes);
     }
     if (lips == null)
     {
         lips = PartList.Static.FindParts(SlotCategory.Mouth);
     }
     if (nose == null)
     {
         nose = PartList.Static.FindParts(SlotCategory.Nose);
     }
     if (ears == null)
     {
         ears = PartList.Static.FindParts(SlotCategory.Ear);
     }
     if (tatt == null)
     {
         tatt = PartList.Static.FindParts(SlotCategory.SkinDetails);
     }
     // Set body type & skin color
     if (RollDice() > 50)
     {
         character.SetBodyType(BodyType.Male);
     }
     else
     {
         character.SetBodyType(BodyType.Female);
     }
     // Equip armors
     character.EquipPart(SlotCategory.Armor, armors[Random.Range(0, armors.Count)]);
     character.EquipPart(SlotCategory.Pants, pants[Random.Range(0, pants.Count)]);
     if (RollDice() > 20)
     {
         character.EquipPart(SlotCategory.Helmet, helmets[Random.Range(0, helmets.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.Helmet, nullpart);
     }
     if (RollDice() > 40)
     {
         character.EquipPart(SlotCategory.Gloves, gloves[Random.Range(0, gloves.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.Gloves, nullpart);
     }
     character.EquipPart(SlotCategory.Boots, boots[Random.Range(0, boots.Count)]);
     if (RollDice() > 60)
     {
         character.EquipPart(SlotCategory.Cape, capes[Random.Range(0, capes.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.Cape, nullpart);
     }
     // Equip weapons
     if (RollDice() > 50)
     {
         character.EquipPart(SlotCategory.MainHand, mainhand[Random.Range(0, mainhand.Count)]);
         Weapon w = character.GetAssignedPart(SlotCategory.MainHand) as Weapon;
         if (RollDice() > 50 && w.weaponCategory != WeaponCategory.TwoHanded)
         {
             character.EquipPart(SlotCategory.OffHand, offhand[Random.Range(0, offhand.Count)]);
         }
     }
     else
     {
         character.EquipPart(SlotCategory.MainHand, nullpart);
         character.EquipPart(SlotCategory.OffHand, nullpart);
     }
     // Equip facial feature
     if (RollDice() > 10)
     {
         character.EquipPart(SlotCategory.Hair, hair[Random.Range(0, hair.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.Hair, nullpart);
     }
     if (RollDice() > 50)
     {
         character.EquipPart(SlotCategory.FacialHair, fhair[Random.Range(0, fhair.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.FacialHair, nullpart);
     }
     if (RollDice() > 2)
     {
         character.EquipPart(SlotCategory.Eyebrow, brow[Random.Range(0, brow.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.Eyebrow, nullpart);
     }
     if (RollDice() > 60)
     {
         character.EquipPart(SlotCategory.Ear, ears[Random.Range(0, ears.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.Ear, "00", "Base");
     }
     character.EquipPart(SlotCategory.Eyes, eyes[Random.Range(0, eyes.Count)]);
     character.EquipPart(SlotCategory.Mouth, lips[Random.Range(0, lips.Count)]);
     character.EquipPart(SlotCategory.Nose, nose[Random.Range(0, nose.Count)]);
     if (RollDice() > 60)
     {
         character.EquipPart(SlotCategory.SkinDetails, tatt[Random.Range(0, tatt.Count)]);
     }
     else
     {
         character.EquipPart(SlotCategory.SkinDetails, nullpart);
     }
 }