public void MirrorPart(DollPartType srcPartType) { if (!DollPartTypes.IsMirrorable(srcPartType)) { return; } var destPartType = DollPartTypes.Mirror(srcPartType); var srcPart = ActiveParts[srcPartType]; var destPath = srcPart != null ? ActiveParts[srcPartType].MirrorPartPath() : null; SetPart(destPartType, destPath); foreach (DollColorType colorType in DollColorTypes.Values) { SetColor(destPartType, colorType, GetColor(srcPartType, colorType)); } foreach (DollRangeType rangeType in DollRangeTypes.Values) { SetRangeFloat(destPartType, rangeType, GetRangeFloat(srcPartType, rangeType)); } }
public DollPart(GameObject go, string path, DollPartType type) { Go = go; Path = path; Type = type; AllowsElements = true; AllowsHair = true; AllowsFacialHair = true; }
public DollPart( GameObject go, string path, DollPartType type, bool allowsElements ) { Go = go; Path = path; Type = type; AllowsElements = allowsElements; AllowsHair = allowsElements; AllowsFacialHair = allowsElements; }
private List <DollPart> GetParts(string branchName, DollPartType type, Transform root, string rootPath) { var branch = root.Find(branchName); var choices = new List <DollPart>(branch.childCount); foreach (Transform child in branch) { var path = $"{rootPath}/{branchName}/{child.transform.name}"; choices.Add(new DollPart(child.gameObject, path, type)); } IndexParts(AllParts, choices); return(choices); }
public void SetPart(DollPartType partType, string path) { ActiveParts[partType]?.Go.SetActive(false); if (path != null) { var newPart = AllParts[path]; newPart.Go.SetActive(true); ActiveParts[partType] = newPart; } else { ActiveParts[partType] = null; } }
public List <DollPart> Get(DollPartType type) { switch (type) { case DollPartType.Head: return(Head); case DollPartType.Eyebrows: return(Eyebrows); case DollPartType.FacialHair: return(FacialHair); case DollPartType.Torso: return(Torso); case DollPartType.ArmUpperRight: return(ArmUpperRight); case DollPartType.ArmUpperLeft: return(ArmUpperLeft); case DollPartType.ArmLowerRight: return(ArmLowerRight); case DollPartType.ArmLowerLeft: return(ArmLowerLeft); case DollPartType.HandRight: return(HandRight); case DollPartType.HandLeft: return(HandLeft); case DollPartType.Hips: return(Hips); case DollPartType.LegRight: return(LegRight); case DollPartType.LegLeft: return(LegLeft); default: throw new InvalidEnumArgumentException(); } }
public List <DollPart> Get(DollPartType type) { switch (type) { case DollPartType.HeadCovering: return(HeadCovering); case DollPartType.Hair: return(Hair); case DollPartType.HeadAttachment: return(HeadAttachment); case DollPartType.BackAttachment: return(BackAttachment); case DollPartType.ShoulderAttachmentRight: return(ShoulderAttachmentRight); case DollPartType.ShoulderAttachmentLeft: return(ShoulderAttachmentLeft); case DollPartType.ElbowAttachmentRight: return(ElbowAttachmentRight); case DollPartType.ElbowAttachmentLeft: return(ElbowAttachmentLeft); case DollPartType.HipsAttachment: return(HipsAttachment); case DollPartType.KneeAttachmentRight: return(KneeAttachmentRight); case DollPartType.KneeAttachmentLeft: return(KneeAttachmentLeft); case DollPartType.Extra: return(Extra); default: throw new InvalidEnumArgumentException(); } }
public static bool IsMirrorable(DollPartType type) { switch (type) { case DollPartType.ArmUpperRight: case DollPartType.ArmUpperLeft: case DollPartType.ArmLowerRight: case DollPartType.ArmLowerLeft: case DollPartType.HandRight: case DollPartType.HandLeft: case DollPartType.LegRight: case DollPartType.LegLeft: case DollPartType.ShoulderAttachmentRight: case DollPartType.ShoulderAttachmentLeft: case DollPartType.ElbowAttachmentRight: case DollPartType.ElbowAttachmentLeft: case DollPartType.KneeAttachmentRight: case DollPartType.KneeAttachmentLeft: return(true); case DollPartType.Head: case DollPartType.Eyebrows: case DollPartType.FacialHair: case DollPartType.Torso: case DollPartType.Hips: case DollPartType.HeadCovering: case DollPartType.Hair: case DollPartType.HeadAttachment: case DollPartType.BackAttachment: case DollPartType.HipsAttachment: case DollPartType.Extra: return(false); default: throw new InvalidEnumArgumentException(); } }
public static string RootBonePath(DollPartType partType) { switch (partType) { case DollPartType.Head: return(neckBone); case DollPartType.Eyebrows: return(eyebrowsBone); case DollPartType.FacialHair: break; case DollPartType.Torso: return(hipBone); case DollPartType.ArmUpperRight: return(armUpperRightBone); case DollPartType.ArmUpperLeft: return(armUpperLeftBone); case DollPartType.ArmLowerRight: return(armLowerRightBone); case DollPartType.ArmLowerLeft: return(armLowerLeftBone); case DollPartType.HandRight: return(handRightBone); case DollPartType.HandLeft: return(handLeftBone); case DollPartType.Hips: return(hipBone); case DollPartType.LegRight: return(legRightBone); case DollPartType.LegLeft: return(legLeftBone); case DollPartType.HeadCovering: break; case DollPartType.Hair: break; case DollPartType.HeadAttachment: break; case DollPartType.BackAttachment: break; case DollPartType.ShoulderAttachmentRight: break; case DollPartType.ShoulderAttachmentLeft: break; case DollPartType.ElbowAttachmentRight: break; case DollPartType.ElbowAttachmentLeft: break; case DollPartType.HipsAttachment: break; case DollPartType.KneeAttachmentRight: break; case DollPartType.KneeAttachmentLeft: break; case DollPartType.Extra: break; default: throw new ArgumentOutOfRangeException(nameof(partType), partType, null); } return(""); }
public void SetMaterial(DollPartType type, Material material) { Materials[type] = material; }
public Material GetMaterial(DollPartType type) { return(Materials[type]); }
private List <DollPart> GetGenderedParts(string branchName, DollPartType type, Transform root, string rootPath, string genderPrefix) { return(GetParts($"{genderPrefix}_{branchName}", type, root, rootPath)); }
public float GetRangeFloat(DollPartType partType, DollRangeType rangeType) { var setting = DollRange.Get(rangeType); return(Materials[partType].GetFloat(setting.Id)); }
public void SetRangeFloat(DollPartType partType, DollRangeType rangeType, float value) { var setting = DollRange.Get(rangeType); Materials[partType].SetFloat(setting.Id, value); }
public Color GetColor(DollPartType partType, DollColorType colorType) { var colorSetting = DollColor.Get(colorType); return(Materials[partType].GetColor(colorSetting.Id)); }
public void SetColor(DollPartType partType, DollColorType colorType, Color color) { var colorSetting = DollColor.Get(colorType); Materials[partType].SetColor(colorSetting.Id, color); }