示例#1
0
        private List <CustomTarget> UpdateCustomTargets(ChaInfo character)
        {
            var customTargets = new List <CustomTarget>();

            foreach (var data in TargetData.data.customTargets)
            {
                bool targetInUse = TargetData.data.quickTargets.Contains(data.target);

                if (!targetInUse)
                {
                    foreach (var target in TargetData.data.customTargets)
                    {
                        if (target.point1 == data.target || target.point2 == data.target)
                        {
                            targetInUse = true;
                            break;
                        }
                    }
                }

                if (targetInUse)
                {
                    var point1 = character.objBodyBone.transform.FindLoop(data.point1);
                    var point2 = character.objBodyBone.transform.FindLoop(data.point2);

                    foreach (var target in customTargets)
                    {
                        if (target.GetTarget().name == data.point1)
                        {
                            point1 = target.GetTarget();
                        }

                        if (target.GetTarget().name == data.point2)
                        {
                            point2 = target.GetTarget();
                        }
                    }

                    if (point1 && point2)
                    {
                        var target = new CustomTarget(data.target, point1, point2, data.midpoint);
                        target.GetTarget().transform.SetParent(character.transform);
                        customTargets.Add(target);
                    }
                    else
                    {
                        Log.Info($"CustomTarget '{data.target}' failed");
                    }
                }
                else
                {
                    Log.Debug($"CustomTarget '{data.target}' skipped because it is not in use");
                }
            }

            return(customTargets);
        }
示例#2
0
        private List <CustomTarget> UpdateCustomTargets(CharInfo character)
        {
            List <CustomTarget> customTargets = new List <CustomTarget>();
            string prefix = character is CharFemale ? "cf_" : "cm_";

            foreach (List <string> data in FileManager.GetCustomTargetNames())
            {
                GameObject point1 = character.chaBody.objBone.transform.FindLoop(prefix + data[1]);
                GameObject point2 = character.chaBody.objBone.transform.FindLoop(prefix + data[2]);

                foreach (CustomTarget target in customTargets)
                {
                    if (target.GetTarget().name == data[1])
                    {
                        point1 = target.GetTarget();
                    }

                    if (target.GetTarget().name == data[2])
                    {
                        point2 = target.GetTarget();
                    }
                }

                if (point1 && point2)
                {
                    float midpoint = 0.5f;
                    if (data.ElementAtOrDefault(3) != null)
                    {
                        if (!float.TryParse(data[3], out midpoint))
                        {
                            midpoint = 0.5f;
                        }
                    }

                    CustomTarget target = new CustomTarget(data[0], point1, point2, midpoint);
                    target.GetTarget().transform.SetParent(character.transform);
                    customTargets.Add(target);
                }
            }

            return(customTargets);
        }