Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
 public DollPart(GameObject go, string path, DollPartType type)
 {
     Go               = go;
     Path             = path;
     Type             = type;
     AllowsElements   = true;
     AllowsHair       = true;
     AllowsFacialHair = true;
 }
Ejemplo n.º 3
0
 public DollPart(
     GameObject go, string path, DollPartType type,
     bool allowsElements
     )
 {
     Go               = go;
     Path             = path;
     Type             = type;
     AllowsElements   = allowsElements;
     AllowsHair       = allowsElements;
     AllowsFacialHair = allowsElements;
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 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;
     }
 }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
        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();
            }
        }
Ejemplo n.º 8
0
        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();
            }
        }
Ejemplo n.º 9
0
        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("");
        }
Ejemplo n.º 10
0
 public void SetMaterial(DollPartType type, Material material)
 {
     Materials[type] = material;
 }
Ejemplo n.º 11
0
 public Material GetMaterial(DollPartType type)
 {
     return(Materials[type]);
 }
Ejemplo n.º 12
0
 private List <DollPart> GetGenderedParts(string branchName, DollPartType type,
                                          Transform root, string rootPath, string genderPrefix)
 {
     return(GetParts($"{genderPrefix}_{branchName}", type, root, rootPath));
 }
Ejemplo n.º 13
0
        public float GetRangeFloat(DollPartType partType, DollRangeType rangeType)
        {
            var setting = DollRange.Get(rangeType);

            return(Materials[partType].GetFloat(setting.Id));
        }
Ejemplo n.º 14
0
        public void SetRangeFloat(DollPartType partType, DollRangeType rangeType, float value)
        {
            var setting = DollRange.Get(rangeType);

            Materials[partType].SetFloat(setting.Id, value);
        }
Ejemplo n.º 15
0
        public Color GetColor(DollPartType partType, DollColorType colorType)
        {
            var colorSetting = DollColor.Get(colorType);

            return(Materials[partType].GetColor(colorSetting.Id));
        }
Ejemplo n.º 16
0
        public void SetColor(DollPartType partType, DollColorType colorType, Color color)
        {
            var colorSetting = DollColor.Get(colorType);

            Materials[partType].SetColor(colorSetting.Id, color);
        }