public void ChangeHair() { if (creator.dca == null) { return; } bool male = creator.dca.activeRace.name == "HumanMale" ? true : false; creator.SelectHair(male ? MaleHairStyleIndex : FemaleHairStyleIndex); if (indexText != null) { indexText.text = ((male ? MaleHairStyleIndex : FemaleHairStyleIndex) + 1).ToString(); } }
public void ChangeHair() { if (creator.dca == null) { return; } bool male = creator.dca.activeRace.name == "HumanMale" ? true : false; if (male) // Male { if (increase) // Increase { if (creator.maleIndex >= creator.maleHairStyles.Count - 1) { creator.maleIndex = 0; index = creator.maleIndex; } else { creator.maleIndex += 1; index = creator.maleIndex; } } if (!increase) // Decrease { if (creator.maleIndex == 0) { creator.maleIndex = creator.maleHairStyles.Count - 1; index = creator.maleIndex; } else { creator.maleIndex -= 1; index = creator.maleIndex; } } } if (!male) // Female { if (increase) // Increase { if (creator.femaleIndex >= creator.femaleHairStyles.Count - 1) { creator.femaleIndex = 0; index = creator.femaleIndex; } else { creator.femaleIndex += 1; index = creator.femaleIndex; } } if (!increase) // Decrease { if (creator.femaleIndex == 0) { creator.femaleIndex = creator.femaleHairStyles.Count - 1; index = creator.femaleIndex; } else { creator.femaleIndex -= 1; index = creator.femaleIndex; } } } creator.SelectHair(index); if (indexText != null) { indexText.text = (index + 1).ToString(); } }