public static bool ApplyParamBust(ParamBustCustom source, DynamicBone_Ver02 target)
        {
            Regex regex = new Regex("_R$");

            //For Params
            //Parameter Patterns[0]="通常"
            target.setGravity(0, new UnityEngine.Vector3(0, source.gravity, 0));

            for (int i = 0; i < target.Patterns[0].Params.Count; i++)
            {
                string boneName = regex.Replace(target.Patterns[0].Params[i].Name, "_L");
                if (source.paramBones.ContainsKey(boneName))
                {
                    ParamBone parameterSet = source.paramBones[boneName];
                    if (parameterSet != null)
                    {
                        parameterSet.CopyParameterTo(target.Patterns[0].Params[i]);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            //For ParticlePtn
            //ParticlePtn Patterns[0]="通常"
            CopyParamsToParticlePtn(target);

            //For Particle. Must set at last.
            target.setPtn(0, true);

            return(true);
        }
示例#2
0
        public static void UpdateButtGravity(DynamicBone_Ver02 bone, Vector3 gravity)
        {
            if (bone == null)
            {
                return;
            }

            bone.setGravity(0, gravity, true);
        }
示例#3
0
        public static void UpdateBustGravity(DynamicBone_Ver02 bone,
                                             int[] changePtn,
                                             Vector3 gravity)
        {
            if (bone == null)
            {
                return;
            }

            foreach (int ptn in changePtn)
            {
                bone.setGravity(ptn, gravity, true);
            }
        }
        public static bool ApplyParamHip(ParamHipCustom source, DynamicBone_Ver02 target)
        {
            List <DynamicBone_Ver02.Particle> particles = GetCharacterParticles(target);

            if (particles != null)
            {
                target.setGravity(0, new UnityEngine.Vector3(0, source.gravity, 0));
                source.CopyTo(particles);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        public bool CopyTo(DynamicBone_Ver02 target)
        {
            FieldInfo fieldInfo = target.GetType().GetField("Particles", BindingFlags.Instance | BindingFlags.NonPublic);
            List <DynamicBone_Ver02.Particle> dstParticles = fieldInfo.GetValue(target) as List <DynamicBone_Ver02.Particle>;

            if (parameters == null || particles == null)
            {
                return(false);
            }

            if (parameters.Count() != target.Patterns[0].Params.Count() ||
                particlesPtn.Count() != target.Patterns[0].ParticlePtns.Count() ||
                particles.Count() != dstParticles.Count())
            {
                return(false);
            }

            target.setGravity(0, gravity);

            for (int i = 0; i < parameters.Count(); i++)
            {
                target.Patterns[0].Params[i].IsRotationCalc = parameters[i].IsRotationCalc;
                target.Patterns[0].Params[i].Damping        = parameters[i].Damping;
                target.Patterns[0].Params[i].Elasticity     = parameters[i].Elasticity;
                target.Patterns[0].Params[i].Stiffness      = parameters[i].Stiffness;
                target.Patterns[0].Params[i].Inert          = parameters[i].Inert;
            }

            for (int i = 0; i < particlesPtn.Count(); i++)
            {
                target.Patterns[0].ParticlePtns[i].IsRotationCalc = particlesPtn[i].IsRotationCalc;
                target.Patterns[0].ParticlePtns[i].Damping        = particlesPtn[i].Damping;
                target.Patterns[0].ParticlePtns[i].Elasticity     = particlesPtn[i].Elasticity;
                target.Patterns[0].ParticlePtns[i].Stiffness      = particlesPtn[i].Stiffness;
                target.Patterns[0].ParticlePtns[i].Inert          = particlesPtn[i].Inert;
            }

            for (int i = 0; i < particles.Count(); i++)
            {
                dstParticles[i].IsRotationCalc = particles[i].IsRotationCalc;
                dstParticles[i].Damping        = particles[i].Damping;
                dstParticles[i].Elasticity     = particles[i].Elasticity;
                dstParticles[i].Stiffness      = particles[i].Stiffness;
                dstParticles[i].Inert          = particles[i].Inert;
            }

            return(true);
        }
        public static bool ApplyParamBust(ParamBustOrg source, DynamicBone_Ver02 target)
        {
            //For Params
            //Parameter Patterns[0]="通常"
            //target.Gravity.Set(source.gravity.x,source.gravity.y,source.gravity.z);
            target.setGravity(0, source.gravity);
            for (int i = 0; i < target.Patterns[0].Params.Count; i++)
            {
                source.parameters[i].CopyParameterTo(target.Patterns[0].Params[i]);
            }

            //For ParticlePtn
            //ParticlePtn Patterns[0]="通常"
            CopyParamsToParticlePtn(target);

            //For Particle. Must set at last.
            target.setPtn(0, true);

            return(true);
        }