Random default characters (#2216)
This commit is contained in:
committed by
GitHub
parent
ba4c596195
commit
32876c78fe
@@ -15,22 +15,11 @@ namespace Content.Client.UserInterface
|
||||
|
||||
private void RandomizeEverything()
|
||||
{
|
||||
RandomizeSex();
|
||||
RandomizeAge();
|
||||
RandomizeName();
|
||||
RandomizeAppearance();
|
||||
}
|
||||
|
||||
private void RandomizeSex()
|
||||
{
|
||||
SetSex(_random.Prob(0.5f) ? Sex.Male : Sex.Female);
|
||||
Profile = HumanoidCharacterProfile.Random();
|
||||
UpdateSexControls();
|
||||
}
|
||||
|
||||
private void RandomizeAge()
|
||||
{
|
||||
SetAge(_random.Next(HumanoidCharacterProfile.MinimumAge, HumanoidCharacterProfile.MaximumAge));
|
||||
UpdateAgeEdit();
|
||||
UpdateNameEdit();
|
||||
UpdateHairPickers();
|
||||
}
|
||||
|
||||
private void RandomizeName()
|
||||
@@ -42,33 +31,5 @@ namespace Content.Client.UserInterface
|
||||
SetName($"{firstName} {lastName}");
|
||||
UpdateNameEdit();
|
||||
}
|
||||
|
||||
private void RandomizeAppearance()
|
||||
{
|
||||
var newHairStyle = _random.Pick(HairStyles.HairStylesMap.Keys.ToList());
|
||||
|
||||
var newFacialHairStyle = Profile.Sex == Sex.Female
|
||||
? HairStyles.DefaultFacialHairStyle
|
||||
: _random.Pick(HairStyles.FacialHairStylesMap.Keys.ToList());
|
||||
|
||||
var newHairColor = _random.Pick(HairStyles.RealisticHairColors);
|
||||
newHairColor = newHairColor
|
||||
.WithRed(RandomizeColor(newHairColor.R))
|
||||
.WithGreen(RandomizeColor(newHairColor.G))
|
||||
.WithBlue(RandomizeColor(newHairColor.B));
|
||||
|
||||
Profile = Profile.WithCharacterAppearance(
|
||||
Profile.Appearance
|
||||
.WithHairStyleName(newHairStyle)
|
||||
.WithFacialHairStyleName(newFacialHairStyle)
|
||||
.WithHairColor(newHairColor)
|
||||
.WithFacialHairColor(newHairColor));
|
||||
UpdateHairPickers();
|
||||
|
||||
float RandomizeColor(float channel)
|
||||
{
|
||||
return MathHelper.Clamp01(channel + _random.Next(-25, 25) / 100f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user